Hey, I ended up posting all of this stuff here: http://code.google.com/p/twitter-api/issues/detail?id=629&colspec=ID%20Stars%20Type%20Status%20Priority%20Owner%20Summary%20Opened%20Modified%20Component This page also has the code I have written
Alright, here's what I got & sent: 1. The error message you get back in the body of your response. (from print_r) Array ( [Failed_to_validate_oauth_signature_or_token] => ) 2. The arguments you are passing into hash_hmac (be sure to obscure secrets) POST&http%3A%2F%2Ftwitter.com%2Fstatuses %2Fupdate.xml&oauth_consumer_key%3DWDylEN0TqSvtz82GOsA15Q%26oauth_nonce %3Da9e12be0541b3905237e949aaa6adf77%26oauth_signature_method%3DHMAC- SHA1%26oauth_timestamp%3D1243632597%26oauth_token%3D30383644- Mm358r44j3uZWFYg5S5alxY58zG0DNjYIjQA18UpE%26oauth_version%3D1.0 The keys variables being passed: $key = encode($c['oauth_consumer_secret'])."&".encode($c ['oauth_token_secret']); (see the encode function above, it is short) 3. The headers and body for the actual request you sent Headers Sent (print_r output): Array ( [0] => Expect: [1] => Authorization: OAuth realm="/statuses/ update.xml",oauth_consumer_key="WDylEN0TqSvtz82GOsA15Q",oauth_signature_method="HMAC- SHA1",oauth_version="1.0",oauth_nonce="d58ddfe633803392d4e52c6d123be7fb",oauth_timestamp="1243632798",oauth_token="",oauth_signature="gOS39H0gkV4tAlZU7y0GRXnlTiQ %3D" ) Body $data['status'] = "I am just testing this!"; -which after turned into a query string is: status=I+am+just+testing+this%21 ================================= The other Oauth things I don't have on my server~ :/, i'm not actually using those for this; so i'm not sure how they will help me. Thanks! On May 30, 3:33 am, John Jawed <[email protected]> wrote: > What is the value of $query, $url and the Signature Base String? > > On a related note, take a look at: > > http://cvs.php.net/viewvc.cgi/pecl/oauth/examples/twitter/ > > You can call OAuth::enableDebug() and inspect debugInfo member which will > give you the in/out/sbs thereby allowing you to compare your results against > pecl/oauth (which works). > > http://us2.php.net/manual/en/oauth.enabledebug.php > > Regards, > John > > On Fri, May 29, 2009 at 7:54 AM, AlfredN <[email protected]> wrote: > > > Hi, I have written code for oauth for a dev i'm doing and i'm having > > problems actually posting updates to twitter via Oauth. I have tested > > code out with verify credentials and other GET methods and it works > > fine however it does not work when I use cURL POST methods in PHP. I > > get invalid token/signature error. Is anyone getting these types of > > problems specifically when posting status updates? Or is this just me? > > Also are there some things I should be doing? Here is my method for a > > POST call: > > > function httpPost($url,$headers,$data){ > > $query = http_build_query($data); > > > $ch = curl_init(); > > curl_setopt($ch, CURLOPT_URL, $url); > > curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); > > curl_setopt($ch, CURLOPT_POST, 1); > > curl_setopt($ch, CURLOPT_POSTFIELDS, "{$query}"); > > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); > > > $result = curl_exec($ch); > > curl_close($ch); > > > return $result; > > } > > > Thanks, I appreciate your help :]
