Invalid_signature Update PUt Method
Please tell me where did I go wrong.... Everytime I execute this statement I get the Error Authorization required.. Invalid Signature.. But when I change the Method to put I get the message Method not allowed... Please help me.. Im stuck at this problem for about 1 week now.
$suid = md5($message["title"] . $message["url"] . $message["description"] . $yahoo["yahoo_guid"] .time());
$response = array();
if (is_null($date)) {
$date = time();
}
$source = sprintf("APP.%s", $app_id);
$url = 'http://social.yahooapis.com/v1/user/' . $guid . '/updates/' . $source . '/' . $suid;
$params['format'] = 'json';
$update = array(
"collectionID" => $guid,
"collectionType" => "guid",
"class" => "app",
"source" => $source,
"type" => 'appActivity',
"suid" => $suid,
"title" => $message["title"],
"description" => $message["description"],
"link" => $message["url"],
"pubDate" => (string)$date
);
$params['updates'] = $update;
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $access_token;
// compute hmac-sha1 signature and add it to the params list
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauthutils::oauth_compute_hmac_sig('PUT',
$url,
$params,
$consumer_secret,
$access_token_secret);
$query_parameter_string = oauthutils::oauth_http_build_query($params, true);
$header = oauthutils::build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
$request_url = $url;
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$headers[] = 'Accept: application/json';
$headers[] = 'Content-Length: ' . strlen($query_parameter_string);
$response = yahoocurl::do_put($request_url,
$query_parameter_string,
80,
$headers);
return $response;
by
1 Reply