It looks like you need to do the OAuth dance:
http://stackoverflow.com/questions/3516931/twitter-oauth-returning-incorrect-signature-please-help


On Mon, Apr 4, 2011 at 3:19 PM, geltogel <luisgn...@gmail.com> wrote:

> Hi everybody..
> Im trying to change twitter user status through my app..
> I already have the acces token but when i try to post I keep reciving
> "Incorrect signature"
>
> Im using php
>  and this is the main code:
>
> $config = array
>  (
>     "requestTokenURL" => "https://api.twitter.com/1/statuses/
> update.json",
>      "requestTokenMethod" => "POST",
>      "signatureMethod" => "HMAC-SHA1",
>     "consumerKey" => "********************",
>      "consumerSecret" => "**********************"
>    );
>
> $requestParameters2 = array
>  (
>    "oauth_consumer_key" => $config['consumerKey'],
>    "oauth_nonce" => md5(time()),
>    "oauth_signature_method" => $config['signatureMethod'],
>        "oauth_token" =>  $oauthToken,
>        "oauth_timestamp" => time(),
>        "oauth_verversion" => "1.0",
>        "status" => urlencode("HeyThere")
>   );
>
> $signatureParameters2 = array();
> foreach ($requestParameters2 as $parameter2 => $value2)
> {
>    $signatureParameters2[] = rfc3986_encode($parameter2) . '=' .
> rfc3986_encode($value2);
> }
>
> $signatureParameters2 = rfc3986_encode(implode('&',
> $signatureParameters2));
>
>
> $baseString =
> urlencode(rfc3986_encode($config['requestTokenMethod'])
>             ."&".rfc3986_encode($config['requestTokenURL'])
>             ."&".$signatureParameters2);
>
> $key = rfc3986_encode($config['consumerSecret']) ."&".
> rfc3986_encode($tokenSecret);
>
> $signature = base64_encode(hash_hmac('sha1', $baseString, $key,
> true));
> $RFC3986signature = rfc3986_encode($signature);
>
> ///// Im olso using this function to code:
> function rfc3986_encode($string)
> {
>    $result = rawurlencode($string);
>    $result = str_replace('%7E', '~', $result);
>    $result = str_replace('=', '%3D', $result);
>    $result = str_replace('+', '%2B', $result);
>
>    return $result;
> }
>
> //////////////this is my header///////
>
> Authorization: OAuth oauth_consumer_key="MIEedQq2dC0ttGgZQ0x***",
> oauth_nonce="6c6a3cf5eeee04125e84f563c668b622",
> oauth_signature_method="HMAC-SHA1", oauth_timestamp="1301954345",
> oauth_token="114032855-6Lc1pnLLx2qhy0YrerDGDlUEucLJAPTgUpytYiPT",
> oauth_signature=aw2S42pl%2BXuJKgua06y8kNQ2zoI%3D, oauth_version=1.0,
> status="HeyThere"
>
> /////////////// thats it /////////////
> I know is much to ask to see all this code but Im so stuck and the
> fact to be so close to have it done makes it worst hehe..
>
> Thanks..
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>



-- 
Jim "Barce" Barcelona

ba...@appdevandmarketing.com

http://appdevandmarketing.com/

http://twitter.com/barce

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to