I am attempting to design a system to integrate into my website's news
management that will allow visitors to click a button/logo and
automatically tweet about it. I can't get past the authentication
step, however.

I'm using Andy Smith's PHP OAuth library to handle all my OAuth work,
and following the tutorial at http://dev.twitter.com/auth to try to
make it all work. I've hit a wall at this point, however:

Now that we have our signature, we have everything we need to make the
request to the endpoint https://api.twitter.com/oauth/request_token.
Now we just generate an HTTP header called "Authorization" with the
relevant OAuth parameters for the request:

When Twitter.com receives our request, it will respond with an
oauth_token, oauth_token_secret (collectively, your "request token"),
and a field called oauth_callback_confirmed that will have the value
of "true" if it's understood your OAuth callback.

In order to actually do this, I'm simply using a page that does the

header("Location: https://api.twitter.com/oauth/request_token";);
header("Authorization: OAuth oauth_nonce=
\"bba01121f573323c0a02656a8d66dddf\", oauth_callback=\"$MY_CALLBACK\",
oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1276484279\",
oauth_consumer_key=\"$MY_KEY\", oauth_signature=
\"k8zuJVVgqi2fgI0QXQm0oxqWSNU=\", oauth_version=\"1.0\"");


$MY_CALLBACK is a urlencode()'d URL, and $MY_KEY is valid. The header
does actually format that information, removed here for privacy.

This doesn't work at all; the header gets lost. If I place the
Location header second, I end up with two sets of headers. The
Authorization header is attached to my actual page, which the headers
from api.twitter do not have this Authorization.

How do I go about getting that header to actually go to Twitter? I've
tried using both fopen() and cURL() methods of posting online, but
they just hang until timeout and fail - likely a configuration setting
by my service provider.

Any help to get those headers posting would be much appreciated. I
figure if I can get these ones posting, the rest of them should follow

Reply via email to