Hi,
What is the body of the response you get back? Many times the
error message is informative and will let us know where to start
looking for possible bugs.
Thanks;
– Matt Sanford / @mzsanford
Twitter Dev
On Jun 24, 2009, at 10:57 AM, ankit1234 wrote:
hi,
i have been repetedly getting error 400 while trying to crete follow
request.
I am using this twitter lib http://github.com/jdp/twitterlibphp/tree/master
.
so basically the content of the code is something like this :-
$postarg=false;
$url="http://twitter.com/friendships/create/xxxx.xml";
// Initialize CURL
$ch = curl_init($url);
// Tell CURL we are doing a POST
curl_setopt ($ch, CURLOPT_POST, true);
// Give CURL the arguments in the POST
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);
// Set the username and password in the CURL call
curl_setopt($ch, CURLOPT_USERPWD,
"xxxx:yyyy");
// Set some cur flags (not too important)
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// execute the CURL call
$response = curl_exec($ch);
// Get information about the response
$responseInfo=curl_getinfo($ch);
// Close the CURL connection
curl_close($ch);
// Make sure we received a response from Twitter
if(intval($responseInfo['http_code'])==200){
// Display the response from Twitter
echo $response;
}else{
// Something went wrong
echo "Error: " . $responseInfo['http_code'];
}
here is the link where i have put this code http://viraltwitters.com/test.php
.
I am not sure why this is happening..Error 400 represents bad request
or reaching the api limit..i have a dedicated api and i am sure i have
not hit the limit..at the same time the code seems correct..so i am
completely clueless why is this happening.
thanks