After working out hosting issues that had been getting in the way up
until now, it seems the next obstacle I have to overcome is a vague
little error I'm getting when trying to request a token for OAuth. I
have tried using the existing PHP libraries but find them to be
cumbersome and difficult to implement compared to what I want to do.
They also result in the exact same error anyway.

My Base string is as follows:
POST&https%3A%2F%2Fapi.twitter.com%2Foauth
%2Frequest_token&oauth_callback%3D<urlencoded callback URL>
%26oauth_consumer_key%3D<my key>%26oauth_nonce
%3Daf560baf046514be37f35cfb02703191%26oauth_signature_method%3DHMAC-
SHA1%26oauth_timestamp%3D1280305432%26oauth_version%3D1.0

The raw data actually sent via the HTTPRequest->send() call is:
POST /oauth/request_token HTTP/1.1 Host: api.twitter.com
Authorization: OAuth
oauth_nonce="af560baf046514be37f35cfb02703191",oauth_callback="<urlencoded
callback URL>",oauth_signature_method="HMAC-
SHA1",oauth_timestamp="1280305432",oauth_consumer_key="<my
key>",oauth_signature="dpb1DoNrlEGskEqNF07PUbevDX0%3D",oauth_version="1.0"
Content-Length: 0

And the server's reply is:
HTTP/1.1 401 Unauthorized
Date: Wed, 28 Jul 2010 03:23:54 GMT
Server: hi
Status: 401 Unauthorized
X-Transaction: 1280287434-24113-10354
Last-Modified: Wed, 28 Jul 2010 03:23:54 GMT
X-Runtime: 0.01052
Content-Type: text/html; charset=utf-8 Content-Length: 44
Pragma: no-cache
X-Revision: DEV
Expires: Tue, 31 Mar 1981 05:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-
check=0
Set-Cookie: k=216.35.123.112.1280287434590399; path=/; expires=Wed, 04-
Aug-10 03:23:54 GMT; domain=.twitter.com
Set-Cookie: guest_id=128028743460788532; path=/; expires=Fri, 27 Aug
2010 03:23:54 GMT
Set-Cookie:
_twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCHDnExcqAToHaWQiJWI2YTQ3NzQ2NWViOTE0%250ANjkzNzUyMDJlMzU0NTMwZGMxIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy
%250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--1f6bcf9e300c057fff20ff7fbb515e851b98fb28;
domain=.twitter.com; path=/
Vary: Accept-Encoding Connection: close
Failed to validate oauth signature and token

I've seen several other posts with similar problems on here, with
varying solutions (or the common lack thereof). Since the error of
"Failed to validate oauth signature and token" doesn't give me much to
look at fixing, I'm hoping someone else might be able to find
something wrong in the information that I'm sending on twitter. The
actual code for the HTTPRequest implementation is:

$ssl_array = array('version' => SSL_VERSION_SSLv3);
$options = array(ssl => $ssl_array);
$TWITTER = new HTTPRequest("https://api.twitter.com/oauth/
request_token", HTTP_METH_POST, $options);
$TWITTER->setHeaders(array("Authorization" => $auth, "Content-Type" =>
"", "Content-Length" => 0, "User-Agent" => "", "Accept" => ""));
//Because not having any POST data results in infinite whitescreen
that won't timeout....
$TWITTER->setRawPostData(" ");
try {
        $res = $TWITTER->send();
}
catch (HttpException $ex) {
        print $ex."<br />\n";
}
print $TWITTER->getRawRequestMessage() . "<br /><br />\n";
print $TWITTER->getRawResponseMessage() . "<br /><br />\n";

Any help would be appreciated.

Reply via email to