I am trying to post a status update to Twitter. I wrote an API call so that when I do
http://.....&token=$token&s=$token_secret&msg=hello ...it works fine when I type the URL into the browser. The status is posted correctly.
However, when I want to post the status via file_get_contents($url) where the $url is the same as how it worked from the browser, I receive a "failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized"
I did some tests, and it has nothing to do with url encoding. I am doing that properly.
So does anyone know why it works through the browser, but not through the code? Does Twitter block non-browser user agents?
Thanks a lot for any help.