Hi, I've been able to get a token and secret for an user but however, I'm getting an error while trying to use the status/update call. I've googled the problem and tried several solutions but none seems to work. I'm not sure what the problem is and I've been looking at this for hours. I would appreciate another pair of eyes on this. Any help would be greatly appreciated. PHP code below.
<?php $oauth_consumer_key = "XXXX"; $oauth_consumer_secret = "YYYY"; $oauth_nonce = sha1(time()); $oauth_signature_method = "HMAC-SHA1"; $oauth_timestamp = time(); $oauth_version = "1.0"; $oauth_token = "AAA"; $token_secret = "BBBB"; $status = "testing test"; $baseString = "oauth_consumer_key=" . rawurlencode($oauth_consumer_key) . "&oauth_nonce=" . rawurlencode($oauth_nonce) . "&oauth_signature_method=" . rawurlencode($oauth_signature_method) . "&oauth_timestamp=" . rawurlencode($oauth_timestamp) . "&oauth_token=" . rawurlencode($oauth_token) . "&oauth_version=" . rawurlencode($oauth_version) . "&status=" . rawurlencode($status); $baseString = "POST&" . rawurlencode("http://api.twitter.com/1/ statuses/update.json") . "&" . rawurlencode($baseString); $signing_key = rawurlencode($oauth_consumer_secret) . "&" . rawurlencode($token_secret); $signature = base64_encode(hash_hmac('sha1', $baseString, $signing_key, true)); $auth = "OAuth oauth_nonce=\"" . $oauth_nonce . "\",oauth_signature_method=\"" . $oauth_signature_method . "\",oauth_timestamp=\"" . $oauth_timestamp . "\",oauth_consumer_key= \"" . $oauth_consumer_key . "\",oauth_token=\"" . rawurlencode($oauth_token) . "\",oauth_signature=\"" . rawurlencode($signature) ."\",oauth_version=\"" . $oauth_version . "\""; $ch = curl_init("http://api.twitter.com/1/statuses/update.json"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect: ", "Authorization: $auth")); $b = curl_exec($ch); var_dump($b); curl_close($ch);