Home
>
Delphi stuff,
Software > Twitter library for Delphi
Twitter library for Delphi
February 27th, 2011
admin
2013 fix/update: http://code.google.com/p/delphi-twitter-library/
Edit: As of December 2012 Twitter api is using GZip in every callback, so you’ll have to enable content encoding before every Get/Post call, and then load the result from a gzipped stream in the RequestDone procs.
Edit June 2012: This twitter library is now deprecated and will no longer be updated. I’ve rewritten it as a generic OAuth lib to use with both Twitter and Imgur (and any other OAuth 1.0 services) for a closed source project.
This is my take on Open Auth and Twitter for Delphi. I recently had to look into it to update a twitter plugin for my Mal Upater application, so I made this small library along with a test application TwitMee. There is barely nothing at all for Delphi, and the little
I found was overcomplicated and didn’t work with Unicode (f.e. japanese symbols etc) (my library does).
I’ve been asked by a few people to make it open source, so here’s the code, use it freely as long you comply with the GPL v3 license.
Requirements: one of the latest versions of Delphi which includes Unicode. (probably easy to adapt using Jedi’s jcl implementation
for unicode strings as well).
[download#7#format=2]
[download#7#format=1]
Twitter object unit:
041 | Uses Windows, SysUtils, Classes, StdCtrls, |
043 | b64ASM, OverbyteIcsSha1, OverbyteIcsHttpProt; |
046 | RequestTokenURL = 'http://api.twitter.com/oauth/request_token' ; |
047 | RequestAccessURL = 'http://api.twitter.com/oauth/access_token' ; |
048 | RequestTwitURL = 'http://api.twitter.com/1/statuses/update.xml' ; |
050 | shell32 = 'shell32.dll' ; |
052 | {$EXTERNALSYM ShellExecute} |
053 | function ShellExecute(hWnd: hWnd; Operation, FileName, Parameters, |
054 | Directory: PWideChar ; ShowCmd: Integer ): HINST; stdcall; |
057 | TwitterRequests = (trDummy, trRequestToken, trRequestAccess, trTwit); |
060 | TwitterCli = class (TObject) |
062 | FOnReqDone: TNotifyEvent; |
063 | FOnBeforeSocketCall: TNotifyEvent; |
065 | procedure TriggerReqDone; virtual; |
066 | procedure TriggerBeforeSocketCall; virtual; |
068 | procedure RecreateSocket; |
072 | procedure HTTPClientDocEnd(Sender: TObject); |
073 | procedure HTTPClientHeaderEnd(Sender: TObject); |
074 | procedure HTTPClientRequestDone(Sender: TObject; RqType: THttpRequest; |
076 | procedure HTTPClientBeforeHeaderSend(Sender: TObject; const Method: string ; |
079 | procedure BuildSignature; |
080 | procedure GetTimeStamp; |
082 | procedure GenerateBaseURL(Method, url: string ); |
083 | procedure ParseTokenandTokenSecret(rawResult: string ); |
084 | procedure ParseAccessData(rawResult: string ); |
088 | ConsumerSecret: string ; |
091 | OAuthTokenSecret: string ; |
093 | AccessTokenSecret: string ; |
095 | AccessScreenName: string ; |
097 | URLRequestToken: string ; |
098 | URLRequestAccess: string ; |
108 | ResultStrings: TStringList; |
109 | LastReq: TwitterRequests; |
112 | LastHttpStatus: Integer ; |
116 | Constructor Create(CKey, CSecret: string ); |
117 | Destructor Destroy; override; |
119 | procedure RequestToken; |
120 | procedure RequestAccess; |
121 | procedure SendTwit(twit: string ); |
124 | function RequestPinURL: string ; |
125 | procedure SetStoredLogin(AToken, ATokenSecret: string ); |
127 | property OnReqDone: TNotifyEvent read FOnReqDone write FOnReqDone; |
128 | property OnBeforeSocketCall: TNotifyEvent read FOnBeforeSocketCall |
129 | write FOnBeforeSocketCall; |
132 | function UrlEncode2( const S: String ): String ; |
133 | function UrlEncodeExceptUnicode( const S: String ): String ; |
134 | function DateTimeToUnix(DelphiTime: TDateTime): Int64 ; |
135 | function urlEncodeRFC3986(url: string ): string ; |
136 | function HasUnicode(src: string ): Boolean ; |
137 | function BuildHexedUtf8String(src: string ): string ; |
141 | function ShellExecute; external shell32 name 'ShellExecuteW' ; |
143 | function BuildHexedUtf8String(src: string ): string ; |
148 | InputString: utf8string; |
149 | StringAsBytes: array of Byte ; |
152 | for a := 1 to length(src) do |
154 | if Ord(src[a]) < 255 then |
157 | Result := Result + '%2520' |
159 | Result := Result + UrlEncode2(src[a]); |
165 | SetLength(StringAsBytes, BinarySize); |
166 | Move(ut[ 1 ], StringAsBytes[ 0 ], BinarySize); |
167 | Result := Result + '%25' + IntToHex(StringAsBytes[ 0 ], 2 ); |
168 | Result := Result + '%25' + IntToHex(StringAsBytes[ 1 ], 2 ); |
169 | Result := Result + '%25' + IntToHex(StringAsBytes[ 2 ], 2 ); |
174 | function HasUnicode(src: string ): Boolean ; |
179 | for a := 1 to length(src) do |
180 | if Ord(src[a]) > 255 then |
184 | function DateTimeToUnix(DelphiTime: TDateTime): Int64 ; |
186 | Result := Round((DelphiTime - 25569 ) * 86400 ); |
189 | function UrlEncode2( const S: String ): String ; |
195 | for I := 1 to length(S) do |
198 | if ((Ch >= '0' ) and (Ch <= '9' )) or ((Ch >= 'a' ) and (Ch <= 'z' )) or |
199 | ((Ch >= 'A' ) and (Ch <= 'Z' )) or (Ch = '.' ) or (Ch = '-' ) or (Ch = '_' ) or |
205 | Result := Result + '%' + IntToHex(Ord(Ch), 2 ); |
210 | function UrlEncodeExceptUnicode( const S: String ): String ; |
216 | for I := 1 to length(S) do |
219 | if ((Ch >= '0' ) and (Ch <= '9' )) or ((Ch >= 'a' ) and (Ch <= 'z' )) or |
220 | ((Ch >= 'A' ) and (Ch <= 'Z' )) or (Ch = '.' ) or (Ch = '-' ) or (Ch = '_' ) or |
221 | (Ch = '~' ) or HasUnicode(Ch) then |
224 | Result := Result + '%' + IntToHex(Ord(Ch), 2 ); |
228 | function urlEncodeRFC3986(url: string ): string ; |
232 | URL1 := UrlEncode2(url); |
233 | URL1 := StringReplace(URL1, '+' , ' ' , [rfReplaceAll, rfIgnoreCase]); |
237 | Constructor TwitterCli . Create(CKey, CSecret: string ); |
242 | ConsumerSecret := CSecret; |
245 | URLRequestToken := RequestTokenURL; |
246 | URLRequestAccess := RequestAccessURL; |
247 | URLTwit := RequestTwitURL; |
249 | ResultStrings := TStringList . Create; |
252 | Destructor TwitterCli . Destroy; |
258 | procedure TwitterCli . BuildSignature; |
262 | SignKey := UrlEncode2(ConsumerSecret) + '&' + UrlEncode2(OAuthTokenSecret); |
263 | Signature := b64ASM . Base64Encode |
264 | (HMAC_SHA1_EX(SignBase, SignKey)); |
266 | if Assigned(DebugMemo) then |
267 | with TMemo(DebugMemo) do |
269 | Lines . Add( '- Build Signature -' ); |
270 | Lines . Add( 'SignKey=' + SignKey); |
271 | Lines . Add( 'Signature=' + Signature); |
272 | Lines . Add( '----------------------------------' ); |
276 | procedure TwitterCli . GetTimeStamp; |
278 | TStamp := IntToStr(DateTimeToUnix(Now)); |
281 | procedure TwitterCli . GetNonce; |
287 | Nonce := Nonce + Chr(Random( 26 ) + 65 ); |
290 | procedure TwitterCli . GenerateBaseURL(Method, url: string ); |
292 | ver, tok, cbak: string ; |
296 | if AccessPIN <> '' then |
297 | ver := 'oauth_verifier=' + AccessPIN + '&' |
302 | tok := 'oauth_token=' + OAuthToken + '&' ; |
303 | if LastReq <> trTwit then |
304 | cbak := 'oauth_callback=oob&' ; |
306 | SignBase := Method + '&' + UrlEncode2(url) + '&' + |
307 | UrlEncode2(cbak + 'oauth_consumer_key=' + ConsumerKey + '&' + 'oauth_nonce=' |
308 | + Nonce + '&' + 'oauth_signature_method=HMAC-SHA1' + '&' + |
309 | 'oauth_timestamp=' + TStamp + '&' + tok + ver |
310 | + 'oauth_version=1.0' ); |
312 | if SendStatus <> '' then |
313 | SignBase := SignBase + UrlEncode2( '&status=' ) + BuildHexedUtf8String |
317 | if Assigned(DebugMemo) then |
318 | with TMemo(DebugMemo) do |
320 | Lines . Add( '- Generate Base URL -' ); |
321 | Lines . Add( 'base=' + SignBase); |
322 | Lines . Add( '----------------------------------' ); |
326 | procedure TwitterCli . RequestToken; |
329 | LastReq := trRequestToken; |
332 | OAuthTokenSecret := '' ; |
334 | AccessTokenSecret := '' ; |
337 | GenerateBaseURL( 'GET' , URLRequestToken); |
339 | Postvars := 'oauth_consumer_key' + '=' + ConsumerKey + '&' + |
340 | 'oauth_signature_method' + '=' + 'HMAC-SHA1' + '&' + 'oauth_signature' + '=' |
341 | + UrlEncode2(Signature) + '' + '&' + 'oauth_timestamp' + '=' + TStamp + '&' |
342 | + 'oauth_nonce' + '=' + Nonce + '&' + 'oauth_token' + '=' + OAuthToken + '&' |
343 | + 'oauth_callback' + '=' + 'oob' + '&' + 'oauth_version' + '=' + '1.0' ; |
347 | HTTPClient . ExtraSendHeader := 'Authorization: OAuth oauth_nonce="' + Nonce + |
348 | '", oauth_callback="oob", oauth_token="' + OAuthToken + |
349 | '", oauth_signature_method="HMAC-SHA1", oauth_timestamp="' + TStamp + |
350 | '", oauth_consumer_key="' + ConsumerKey + '", oauth_signature="' + |
351 | UrlEncode2(Signature) + '", oauth_version="1.0"' ; |
356 | RcvdStream := TMemoryStream . Create; |
361 | url := URLRequestToken; |
365 | if Assigned(DebugMemo) then |
366 | with TMemo(DebugMemo) do |
368 | Lines . Add( '- Request Token Start -' ); |
369 | Lines . Add( 'postvars=' + Postvars); |
370 | Lines . Add( 'url=' + url); |
371 | Lines . Add( '----------------------------------' ); |
382 | ResultStrings . Text := 'ERROR ' + E . Message; |
383 | LastHttpStatus := HTTPClient . StatusCode; |
385 | FreeAndNil(HTTPClient); |
392 | procedure TwitterCli . RequestAccess; |
395 | LastReq := trRequestAccess; |
397 | GenerateBaseURL( 'GET' , URLRequestAccess); |
399 | Postvars := 'oauth_consumer_key' + '=' + ConsumerKey + '&' + 'oauth_nonce' + |
400 | '=' + Nonce + '&' + 'oauth_signature_method' + '=' + 'HMAC-SHA1' + '&' + |
401 | 'oauth_signature' + '=' + UrlEncode2(Signature) + '' + '&' + |
402 | 'oauth_timestamp' + '=' + TStamp + '&' + 'oauth_token' + '=' + OAuthToken + |
403 | '&' + 'oauth_callback' + '=' + 'oob' + '&' + 'oauth_verifier' + '=' + |
404 | AccessPIN + '&' + 'oauth_version' + '=' + '1.0' ; |
409 | HTTPClient . ExtraSendHeader := 'Authorization: OAuth oauth_nonce="' + Nonce + |
410 | '", oauth_callback="oob", oauth_token="' + OAuthToken + |
411 | '", oauth_verifier="' + AccessPIN + |
412 | '", oauth_signature_method="HMAC-SHA1", oauth_timestamp="' + TStamp + |
413 | '", oauth_consumer_key="' + ConsumerKey + '", oauth_signature="' + |
414 | UrlEncode2(Signature) + '", oauth_version="1.0"' ; |
419 | RcvdStream := TMemoryStream . Create; |
420 | url := URLRequestAccess; |
424 | if Assigned(DebugMemo) then |
425 | with TMemo(DebugMemo) do |
427 | Lines . Add( '- Request Access Start -' ); |
428 | Lines . Add( 'postvars=' + Postvars); |
429 | Lines . Add( 'url=' + url); |
430 | Lines . Add( '----------------------------------' ); |
440 | ResultStrings . Text := 'ERROR ' + E . Message; |
441 | LastHttpStatus := HTTPClient . StatusCode; |
442 | FreeAndNil(HTTPClient); |
450 | procedure TwitterCli . SendTwit(twit: string ); |
458 | if HasUnicode(twit) then |
460 | twit := UrlEncodeExceptUnicode(twit); |
465 | SendStatus := UrlEncode2(utf8Encode(twit)); |
468 | GenerateBaseURL( 'POST' , URLTwit); |
470 | Postvars := 'oauth_consumer_key' + '=' + ConsumerKey + '&' + 'oauth_nonce' + |
471 | '=' + Nonce + '&' + 'oauth_signature_method' + '=' + 'HMAC-SHA1' + '&' + |
472 | 'oauth_signature' + '=' + UrlEncode2(Signature) + '' + '&' + |
473 | 'oauth_timestamp' + '=' + TStamp + '&' + 'oauth_token' + '=' + AccessToken + |
474 | '&' + 'oauth_callback' + '=' + 'oob' + '&' + 'oauth_version' + '=' + '1.0' ; |
476 | if HasUnicode(twit) then |
477 | Postvars := 'status=' + ((utf8Encode(twit))) |
479 | Postvars := 'status=' + UrlEncode2(twit); |
485 | HTTPClient . ExtraSendHeader := 'Authorization: OAuth ' + 'oauth_consumer_key="' |
486 | + ConsumerKey + '", oauth_signature_method="HMAC-SHA1", oauth_timestamp="' + |
487 | TStamp + '", oauth_nonce="' + Nonce + |
488 | '", oauth_version="1.0", oauth_token="' + AccessToken + |
489 | '", oauth_signature="' + UrlEncode2(Signature) + '"' ; |
494 | RcvdStream := TMemoryStream . Create; |
495 | SendStream := TMemoryStream . Create; |
496 | SendStream . Write (Postvars[ 1 ], length(Postvars)); |
497 | SendStream . Seek( 0 , soFromBeginning); |
502 | if Assigned(DebugMemo) then |
503 | with TMemo(DebugMemo) do |
505 | Lines . Add( '- Request twit Start -' ); |
506 | Lines . Add( 'postvars=' + Postvars); |
507 | Lines . Add( 'url=' + url); |
508 | Lines . Add( '----------------------------------' ); |
520 | ResultStrings . Text := 'ERROR ' + E . Message; |
521 | LastHttpStatus := HTTPClient . StatusCode; |
522 | FreeAndNil(HTTPClient); |
530 | procedure TwitterCli . TriggerReqDone; |
532 | if Assigned(FOnReqDone) then |
536 | procedure TwitterCli . TriggerBeforeSocketCall; |
538 | if Assigned(FOnBeforeSocketCall) then |
539 | FOnBeforeSocketCall(Self); |
542 | procedure TwitterCli . HTTPClientDocEnd(Sender: TObject); |
547 | procedure TwitterCli . HTTPClientBeforeHeaderSend(Sender: TObject; |
548 | const Method: string ; Headers: TStrings); |
551 | if Assigned(DebugMemo) then |
552 | with TMemo(DebugMemo) do |
554 | Lines . Add( '- Socket Before Header Send -' ); |
555 | Lines . Add(Headers . Text); |
556 | Lines . Add( '----------------------------------' ); |
560 | procedure TwitterCli . HTTPClientHeaderEnd(Sender: TObject); |
563 | if Assigned(DebugMemo) then |
564 | with TMemo(DebugMemo) do |
566 | Lines . Add( '- Socket Header End -' ); |
567 | Lines . Add(HTTPClient . RcvdHeader . Text); |
568 | Lines . Add( '----------------------------------' ); |
572 | procedure TwitterCli . HTTPClientRequestDone(Sender: TObject; |
573 | RqType: THttpRequest; ErrCode: Word ); |
577 | if Assigned(DebugMemo) then |
578 | with TMemo(DebugMemo) do |
580 | Lines . Add( '- Request Done Socket DocEnd -' ); |
581 | Lines . Add( 'result=' + ResultStrings . Text); |
582 | Lines . Add( 'status code=' + IntToStr(HTTPClient . StatusCode)); |
583 | Lines . Add( 'headers=' + HTTPClient . RcvdHeader . Text); |
584 | Lines . Add( '----------------------------------' ); |
587 | if (RqType = httpGET) or (RqType = httpPOST) then |
589 | if (ErrCode <> 0 ) or (HTTPClient . StatusCode <> 200 ) then |
596 | HTTPClient . RcvdStream . WriteBuffer(# 0 ' ' , 1 ); |
597 | HTTPClient . RcvdStream . Position := 0 ; |
598 | ResultStrings . LoadFromStream(HTTPClient . RcvdStream); |
602 | LastHttpStatus := HTTPClient . StatusCode; |
604 | if (LastReq = trRequestToken) and (LastHttpStatus = 200 ) then |
605 | ParseTokenandTokenSecret(ResultStrings . Text); |
606 | if (LastReq = trRequestAccess) and (LastHttpStatus = 200 ) then |
607 | ParseAccessData(ResultStrings . Text); |
611 | HTTPClient . RcvdStream . Destroy; |
612 | HTTPClient . RcvdStream := nil ; |
613 | if LastReq = trTwit then |
615 | HTTPClient . SendStream . Destroy; |
616 | HTTPClient . SendStream := nil ; |
618 | FreeAndNil(HTTPClient); |
624 | procedure TwitterCli . RecreateSocket; |
626 | HTTPClient := THttpCli . Create( nil ); |
629 | OnDocEnd := HTTPClientDocEnd; |
630 | OnHeaderEnd := HTTPClientHeaderEnd; |
631 | OnRequestDone := HTTPClientRequestDone; |
632 | OnBeforeHeaderSend := HTTPClientBeforeHeaderSend; |
633 | TriggerBeforeSocketCall; |
637 | procedure TwitterCli . ParseTokenandTokenSecret(rawResult: string ); |
640 | if Pos( 'oauth_callback_confirmed=true' , rawResult) = 0 then |
647 | Delete(rawResult, 1 , Pos( '=' , rawResult)); |
648 | OAuthToken := Copy(rawResult, 1 , Pos( '&oauth_token_secret=' , |
650 | Delete(rawResult, 1 , Pos( '=' , rawResult)); |
651 | OAuthTokenSecret := Copy(rawResult, 1 , Pos( '&oauth_callback_confirmed=true' , |
658 | if Assigned(DebugMemo) then |
659 | with TMemo(DebugMemo) do |
661 | Lines . Add( '- Parse Token and TokenSecret -' ); |
662 | Lines . Add( 'Token=' + OAuthToken); |
663 | Lines . Add( 'TokenSecret=' + OAuthTokenSecret); |
664 | Lines . Add( '----------------------------------' ); |
669 | procedure TwitterCli . RequestPIN; |
671 | ShellExecute( 0 , nil , PChar ( 'https://twitter.com/oauth/authorize?oauth_token=' |
672 | + OAuthToken), '' , '' , SW_SHOWNORMAL); |
675 | function TwitterCli . RequestPinURL; |
677 | Result := 'https://twitter.com/oauth/authorize?oauth_token=' + OAuthToken; |
680 | procedure TwitterCli . ParseAccessData(rawResult: string ); |
683 | if Pos( 'user_id' , rawResult) = 0 then |
690 | Delete(rawResult, 1 , Pos( '=' , rawResult)); |
691 | AccessToken := Copy(rawResult, 1 , Pos( '&oauth_token_secret=' , |
693 | Delete(rawResult, 1 , Pos( '=' , rawResult)); |
694 | AccessTokenSecret := Copy(rawResult, 1 , Pos( '&user_id=' , rawResult) - 1 ); |
695 | Delete(rawResult, 1 , Pos( '=' , rawResult)); |
696 | AccessUserID := Copy(rawResult, 1 , Pos( '&screen_name=' , rawResult) - 1 ); |
697 | Delete(rawResult, 1 , Pos( '=' , rawResult)); |
698 | AccessScreenName := rawResult; |
700 | OAuthToken := AccessToken; |
701 | OAuthTokenSecret := AccessTokenSecret; |
707 | if Assigned(DebugMemo) then |
708 | with TMemo(DebugMemo) do |
710 | Lines . Add( '- Parse Access Data -' ); |
711 | Lines . Add( 'AccessToken=' + AccessToken); |
712 | Lines . Add( 'AccessTokenSecret=' + AccessTokenSecret); |
713 | Lines . Add( 'AccessUserID=' + AccessUserID); |
714 | Lines . Add( 'AccessScreenName=' + AccessScreenName); |
715 | Lines . Add( '----------------------------------' ); |
720 | procedure TwitterCli . SetStoredLogin(AToken: string ; ATokenSecret: string ); |
722 | AccessToken := AToken; |
723 | AccessTokenSecret := ATokenSecret; |
724 | OAuthToken := AccessToken; |
725 | OAuthTokenSecret := AccessTokenSecret; |
usage
006 | Twit := TwitterCli . Create(TKey, TSecret); |
013 | OnReqDone := TwitterCallBackProc; |
014 | RefURL := 'https://eden.fm' ; |
018 | procedure TTwitMeMain . TwitterCallBackProc(Sender: TObject); |
048 | Twit . AccessPIN := Edit1 . Text; |
060 | Twit . SendTwit( 'test message' ); |
081 | procedure TTwitMeMain . TwitterCallBackProc(Sender: TObject); |
083 | if Twit . LastHttpStatus <> 200 then |
085 | Label1 . Font . Color := clRed; |
086 | Label1 . Caption := 'Error communicating with Twitter.' ; |
090 | if Twit . LastReq = trRequestToken then |
092 | FlatEdit1 . Text := 'Enter PIN here and click on Send button' ; |
096 | if Twit . LastReq = trRequestAccess then |
098 | Label1 . Font . Color := clWhite; |
099 | Label1 . Caption := 'Ready to send.' ; |
100 | Authenticated := True ; |
105 | if Twit . LastReq = trTwit then |
108 | Label1 . Caption := 'Message sent.' ; |
I didn’t have time to convert my generic OAuth1 lib for this, but I uploaded a fixed version of the older Twitter lib, you can get it here: http://code.google.com/p/delphi-twitter-library/
sorry, those are properties of THttpCli, so like.. with HttpCli1 do begin.. Options := etc
Hi Brian, that is Excellent, Thank you so much, I guess the new library will also get around the December 2012 issues that I have also been posting about.
Hi Brian, thanks for the response, maybe I’m a bit stupid or something, but if I put that code on any line it simply gives me the error of
Undeclared Identifier Options, and Undeclared identifier httpoEnableContentcoding.
Clearly I am not really understanding what you are suggesting, though I have no doubt that what you say works when correctly implemented
Yeah.. that was a workaround I used at the time. Well I’ll do something, give me a couple days and I’ll release my new generic library with a new demo app for twitter; watch the front page for the post.
The above code doesn’t work for me because I get ” Undeclared Identifier ExtraSendHeader “. I have tried to look that up but all I can find is some relatively old posts on ICS where it seems to say that it is to do with a custom mod that you made to ICS , but would no longer be using because there was some slightly modified code that made it unnecessary.
I would sincerely appreciate a solution.
Many thanks
just replace it with a normal TEdit
You have to modify my code, and before any Get/Post calls, simply add “Options := [httpoEnableContentCoding];”
That doesn’t work for me not least of which because it uses TFlatEditUnit which I can’t seem to locate a working download/install for D2007
Is it possible to give some more detailed instructions for those of us that aren’t that clever. I am using D2007 and I can’t really get it to work at all and I am sure it is related to what you are saying above
Hi Stephen, Sorry to say I don’t really understand a word about what you are saying with enable content encoding. Could you possibly give some code as to what I should put and where. Many thanks
Thanks for your swift reply. I think I’ve got it working in Delphi6 now.
Also add OverbyteIcsHttpCCodZLib to project source.
that’s all you need, but stable ics release doesn’t work properly with gzip, install the latest daily v8: http://wiki.overbyte.be/arch/icsv8w.zip
[re:As of December 2012 Twitter api is using GZip in every callback]…so you’ll have to enable content encoding before every Get/Post call,I guess that means adding this line (please confirm)
Options := [httpoEnableContentCoding];
…and then load the result from a gzipped stream in the RequestDone procs.
Please give an example of the Delphi code I need to put in the RequestDone procs.
I’m using ICS V1.94 which I believe already handles gzip content encoding.
this code only utf-8 but i need this char (ü,i,ğ,ç,ö). can u help for this?
i cant use ‘ü,ğ,ç,ı’ and i need.
Sorry for the late reply; haven’t worked on this for ages, maybe I’ll review it sometime, been wanting to make a full OAuth1/2 lib for a while.
Hi, not sure what’s your issue.
Hi Brian. Thanks a lot. But i have some problem about charset.
How can i change charset?
I need iso8959-9
. Please help me
http://eden.fm/twitmee/
http://eden.fm/twitmee/
Dear brian..
Can I receive 0.22 example source ?Thank you.
Thanks for your source.
Can I receive delphi example source file ?
Hello Brian.
I’m testing your code but I have some trouble with accented characters which are really common in Italian language. If i try to tweet the message “Questa è una prova”, the TwitMee app gets an OAuth error. How can I solve this?
You need the ICS sockets library: http://www.overbyte.be
Dear brian, The rar that I downloaded had only the TwitterLib.pas file, seems it didn’t include the two other files you used:
OverbyteIcsHttpProt.pas
OverbyteIcsSha1.pas
useage.pas b64ASM.pasIf possible, please send these through to joan@autochartering.com
regards Joan
Sorry I got no time for free support on this
i have error in utf8 tweets : how can i fix it ? ( i use last version
tnx for help and great library
If you are interested I’ll let you know when my app. is released.Great work and thanks for sharing your skills.
web Design london
Dear Steve,
I would like to receive your implementation in Delphi 6, it’s the only I can use in my activities. Thanks in advance.
Antonio Borges
Those files are from the ICS package as mentioned in the info about the library.
Dear brian, The rar that I downloaded had only the TwitterLib.pas file, seems it didn’t include the two other files you used:
OverbyteIcsHttpProt.pas
OverbyteIcsSha1.pas
useage.pasb64ASM.pasIf possible, please send these through to groupby at gmail.comthanks and regards,Jane
Hi brian, also the rar that I downloaded had only the TwitterLib.pas file, and didn’t include the two other files you mention:
OverbyteIcsHttpProt.pas
useage.pas
could you also please send these through to adamr99 at gmail.com
thanks and regards,
adam
Hi brian, thanks for posting this code. I’ve been comparing this code to other delphi twitter libraries and am still a bit unclear on how to make it work. As below it would be great to get the source to the latest TwitMee app so I could see where I was going wrong. please send to adamr99 at gmail.com
thanks in advance.
regards,
adam
Thanks you very much for the fast reply!
sent
hi brian,
This is a nice work you have done:)
Unfortunately, I am having difficulties in making the library work with a test sample i built with delphi 2010.
If it is possible, I would love as well to receive the source code for the TwitMee 0.22. My email is victorvicente at netcabo.pt
Thanks a lot!
Victor
Many thanks for the source brian,
I was able to get it working in Delphi6 (and with Unicode too I think). I’m using the TntComponents for Unicode.
Great work and thanks for sharing your skills.
If you are interested I’ll let you know when my app. is released.
Hi, it was made for Unicode Delphi, it won’t work as it is for 6 without some changes. I’ll send you the little app source anyway
Hello,
I’ve spent a fair while trying to get your code to work in Delphi6.
Unfortunately I’m still getting ‘Status: 401 Unauthorized’ errors’.
I’m nearly there but am now stuck.
Would it be possible for you to send me the source for TwitMee V0.22 so I can see where I’m going wrong.
My email is ‘twitter at play-time.demon.co.uk’
Many Thanks in advance
this is superb blog and i got a lot from this blog. thanks a lot form sharing this useful stuffs with us.
Hi! Nice Stuff. I want to see TwitMee sources or another example for this lib. Of course if possible. Please sent to “purrpurrpurr11 at gmail.com”. Thx. =)
sent
Hello
Please could you send me the source of the “TwitMee – 0:22” as an example of using the “Delphi library for Twitter”?
If possible, please send to “levifernandes@ig.com.br.”
Thank you.