Hi everyone,
I want to post a message from a php page to twitter account.
like i want to post message to twitterId:dines h1985singh for that I am using given code: but it doesn't working
I google it out lot for this but didn't get success.
Can anyone suggest me where would i made mistake.
Thanks
I want to post a message from a php page to twitter account.
like i want to post message to twitterId:dines h1985singh for that I am using given code: but it doesn't working
Code:
<?php
$username = 'xyz';
$password = 'pwd';
$message = 'hii';
$host = "http://twitter.com/statuses/update.xml?status=".urlencode(stripslashes(urldecode($message)));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
$returnData = curl_getinfo($ch);
$result = curl_exec($ch);
// Look at the returned header
$resultArray = curl_getinfo($ch);
curl_close($ch);
echo "<pre/>";
print_r($resultArray);
?>
Can anyone suggest me where would i made mistake.
Thanks
Comment