Thread Twittern mit Perl und Oauth
(10 answers)
Opened by Lars at 2010-09-02 23:50 Guest Lars In einem HTTP-Kopf werden Zeilen, die mit einem Leerzeichen beginnen, an den Wert für das vorangehende Feld angehängt. Nach dem Beispiel aus der Dokumentation zu schließen muss das also eher so aussehen: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 sub join_pairs { my ($separator, @items) = @_; local ($a, $b); my @result; push @result, "$a$separator$b" while (($a, $b, @items) = @items); @result; } my $request = HTTP::Request->new(POST => $api_url); $request->header( authorization => 'OAuth ' . join(',', join_pairs('=', realm => "https://api.twitter.com/oauth/", oauth_nonce => $oauth_nonce, oauth_signature_method => $oauth_signature_method, oauth_timestamp => $oauth_timestamp, oauth_consumer_key => $oauth_consumer_key, oauth_token => $oauth_token, oauth_signature => $signature, oauth_version => $oauth_version, status => $status )) ); $request->content_type("text/xml; charset=utf-8"); my $result = $agent->request($request); (edit: vergessene Klammern in Zeile 4 ergänzt) Last edited: 2010-09-03 17:35:38 +0200 (CEST) When C++ is your hammer, every problem looks like your thumb.
|