Twitter API - Failed to validate oauth signature and token PHP / CURL -


I have tried all kinds of variations in the last few hours, but this phase 1, according to Twitter API!

1 In addition I have made the script went down that I was involved: $ header = array ( "Expect:");

This is me helped other questions

The problem: Ohrit signature failed and token response to valid every time !!!

For example my post data:

P>

  Arre ([oauth_callback] = & gt; http://www.mysite.com//index. php [oauth_consumer_key] = & gt; hidden [oauth_nonce] = & gt; hide [oauth_signature_method] = & gt; Acmsi-SHA 1 [Oath_taimstamp] = & gt; 1301270847 [Oath_warjn] = & gt; 1.0)  < / pre> 

and my header data:

  Arre ([0] = & Gt; expect :)   

script:

  $ consumer_key = "hidden"; $ Consumer_secret = "hidden"; Post_Data function ($ url, $ data, $ header) {$ ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, $ url); Curl_setopt ($ CH, CURLOPT_POST, 1); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ data); Curl_setopt ($ CH, CURLOPT_HTTPHEADER, $ header); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); $ Result = curl_xac ($ CH); Curl_close ($ ch); Return result; } $ Data ['oauth_callback'] = "http: //". $ _ Server ['HTTP_HOST']. $ _ Server ['PHP_SELF']; $ Data ['oauth_consumer_key'] = $ consumer_key; $ Data ['oauth_nonce'] = MD5 (time ()); $ Data ['oauth_signature_method'] = "HMAC-SHA1"; $ Data ['oauth_timestamp'] = time (); $ Data ['oauth_version'] = "1.0"; $ Header = array ("expected:"); $ Content = Post_Data ("http://api.twitter.com/oauth/request_token", $ data, $ title); Print_r ($ content);   

Can anyone see a clear error that I can make it here? Preferably I would not like to go with any elses code because most examples are full classes & amp; Huge task, I'm looking for the simplest approach!

Your problem is that you have an OAuth signature in your request.
You can read about the concept on this.
An implementation implementation can be found.

Comments