Hi together,
I am a newbie to twitter API. And it is the same with all API: once you get it, its easy. But I didn’t get it until now.
I have a website (www.meier-krantechnik.de) that should tweet when a new crane is for sale. Currently my PHP application fails during requesting a request token. Here my PHP code:
$config -> social_app_id = "consumer key";
$config -> social_app_secret = "consumer secret";
// get our request token
try {
$oauth = new OAuth($config -> social_app_id, $config -> social_app_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
// Generate request token
$request_token_info = $oauth -> getRequestToken('https://twitter.com/oauth/request_token');
}
catch(OAuthException $e) {
print "Error: ". $e -> getMessage() ."<br />";
}
The following exception is caught: “Error: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)”
I found this code snippet here: http://toys.lerdorf.com/archives/50-Using-pecloauth-to-post-to-Twitter.html.
Can anyone help me what went wrong? Or do I have to start another way?
Any hints are welcome. Thanks in advance!
Tobias