Hi everyone,
I'm trying to get a request signed so I can get me a request token and
got completely stuck! I have used the info that twitter use in their
example in the documentation to be sure that I have formatted my data
correctly etc. I have identical "Basestring" and "Key" but still I'm
not getting the same "Signature". I have looked at several other
examples and I seem to have done the same thing as most people have
done.
Would love some help to sort this out!
Here is the code:
------------------------------------<code
>----------------------------------------------
private function sign_request($http_method, $url, $params, $oath)
{
// SET BASE STRING
$sign_params = $this->set_sign_params($params, $oath);
$sign_url = $this->set_sign_url($url);
$base_string = $this->set_sign_basestring($http_method,
$sign_params, $sign_url);
print $base_string; // Output the same as the twitter example:
POST&https%3A%2F%2Fapi.twitter.com%2Foauth
%2Frequest_token&oauth_callback%3Dhttp%3A%2F%2Flocalhost
%3A3005%2Fthe_dance%2Fprocess_callback%3Fservice_provider_id
%3D11%26oauth_consumer_key%3DGDdmIQH6jhtmLUypg82g%26oauth_nonce
%3DQP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk%26oauth_signature_method
%3DHMAC-SHA1%26oauth_timestamp%3D1272323042%26oauth_version%3D1.0
// GET HMAC-SHA1 SIGNATURE
if($this->signature_method == 'HMAC-SHA1')
{
// SET KEY
$key = $this->set_sign_key();
print $key; // Output the same as the twitter example:
MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98&
//SIGN
$signature = base64_encode(hash_hmac('sha1', $base_string,
$key, true));
print $signature; // DO NOT output the same as the twitter
example. Twitteroutput: 8wUi7m5HFQy76nowoCThusfgB+Q= and my outout:
Ewqbgi+AMRZGMcqwQTjhE5/ZD80=
}
return $signature;
}
------------------------------------</code
>----------------------------------------------
What have I missed? Anyone got any Idea?
Also a "fun" thing is that if I set the signture to the one in the
twitter example I still can't get a request token...
Thanks in advanced!
--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
https://groups.google.com/forum/#!forum/twitter-development-talk