[PHP] Creating Oauth_signature failed

dengpan_huang
Community Novice

Hello, Team

I have a problem on creating Oauth_signature.

Here is my codes, could you help me correct it ? Thank you very much!

$string='GET&'.urlencode('about:blank').'&'.urlencode('oauth_consumer_key='.$_POST['oauth_consumer_key'].'&oauth_nonce='.$_POST['oauth_nonce'].'&oauth_signature_method='.$_POST['oauth_signature_method'].'&oauth_timestamp='.$_POST['oauth_timestamp'].'&oauth_version='.$_POST['oauth_version']);

$oauth_signature= base64_encode(hash_hmac('sha1',$string,"123",TRUE));

$oauth_signature doesn't match with $_POST['oauth_signature']

Here is the params we can get.

$params =  array(

  'oauth_consumer_key' => $_POST['oauth_consumer_key'],

  'oauth_nonce' => $_POST['oauth_nonce'],

  'oauth_signature_method' => $_POST['oauth_signature_method'],

  'oauth_timestamp' => $_POST['oauth_timestamp'],

  'oauth_version' => $_POST['oauth_version']

  );

Callback result:

206842_pastedImage_1.png

0 Likes