themattharris/tmhOAuth — Issue #31: Could not authenticate with OAuth (II).
Author: isilion
Created: 2012-03-02 02:44:30+00:00
State: open

Hi again Matt.

I keep using your library (it was easy with the code you provided; i almost had to do none reestructurement of the full program).

However, to the moment of thruth, fails at the same moment than the other library (so i suppose it could be a non related issue, but who knows...). I dumped the response['info'] variable and i got this:

{"error":"Could not authenticate with OAuth.","request":"\/1\/statuses\/update.json"}

array(22) { ["url"]=> string(46) "https://api.twitter.com/1/statuses/update.json" ["content_type"]=> string(31) "application/json; charset=utf-8" ["http_code"]=> int(401) ["header_size"]=> int(880) ["request_size"]=> int(520) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(0.98396) ["namelookup_time"]=> float(0.04196) ["connect_time"]=> float(0.243824) ["pretransfer_time"]=> float(0.751436) ["size_upload"]=> float(7) ["size_download"]=> float(100) ["speed_download"]=> float(101) ["speed_upload"]=> float(7) ["download_content_length"]=> float(100) ["upload_content_length"]=> float(0) ["starttransfer_time"]=> float(0.982842) ["redirect_time"]=> float(0) ["certinfo"]=> array(0) { } ["request_header"]=> string(513) "POST /1/statuses/update.json HTTP/1.1 User-Agent: ARbTot Host: api.twitter.com Accept: */* Accept-Encoding: deflate, gzip Authorization: OAuth oauth_consumer_key="*****", oauth_nonce="8deb6d0be9e8fcf8427d0535702c12ff", oauth_signature="CXTJgfaWljHCgugrRAhy3xUlmfw%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1330655558", oauth_token="******", oauth_version="1.0" Content-Length: 7 Content-Type: application/x-www-form-urlencoded " } string(0) "" 0

POSTED // This is supposed to happen when tweet is succesfull: write POSTED and the tweet:

RT @mowgdrums @cigarete_smoke @moon_glasses Esta claro, aunque yo soy mas de M. #llamadmerebeldesiquereis @ManuAlpuente LOOOOOOOOOL!!!

And this is the code belonging to that output:

$ckey,
'consumer_secret' => $csec,
));

$code = $tweet->request('POST', $tweet->url('1/statuses/update'), array(
'status' => $string
));

if ($code == 200) {
tmhUtilities::pr(json_decode($tweet->response['response']));
var_dump($tweet->response['info']);
var_dump($tweet->response['error']);
echo $tweet->response['errno'];
echo "POSTED\n";
} else {
tmhUtilities::pr($tweet->response['response']);
var_dump($tweet->response['info']);
var_dump($tweet->response['error']);
echo $tweet->response['errno'];
echo "POSTED\n";

}
}

?>

So i got the error: {"error":"Could not authenticate with OAuth.","request":"\/1\/statuses\/update.json"}

Hope given enough debug info. Actually, with the other library (twitterOAuth) i had the same problem. It posted 3 spreads of ~ 100 tweets, then broke. Changed twitter account and made a new app. Double checked the keys and secrets. What i'm missing?