Don't reinvent the wheel. Use one of the many existing php libraries for generating valid OAuth requests.
Your mistake is likely to be in missing sorting, wrong encoding, or other similar issues - all which is dealt with correctly in one of the many (good) libraries..
Here would be the equiv. code to perform the request using the PHP library hosted at oauth.net:
// setup consumer and callback
$consumer = new OAuthConsumer('consumer-key', 'consumer-secret');
$callback = 'http://your-callback.com/callback';
// setup the request
$request = OAuthRequest::from_consumer_and_token(
$req->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, null);
// perform the request
$curl = curl_init();
$params = $req->get_parameters();
foreach( array_keys($params) AS $i )
if( substr($i, 0, 6) == 'oauth_' )
$url = $req->get_normalized_http_url() . '?' . http_build_query($params);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
$response = curl_exec($curl);
(I just wrote / adjusted existing code in my email-app, so no guarantees it'll work. But you'll get the idea..)
The other libraries (like oauth-php, the pecl-extension etc) will have similar functionalites. So please use a library instead of trying to reinvent the wheel. It should save yourself a lot of trouble.
> You received this message because you are subscribed to the Google Groups "OAuth PHP" group.
> To post to this group, send email to oaut...@googlegroups.com.
> To unsubscribe from this group, send email to oauth-php+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/oauth-php?hl=en.