Problem related to auto Twitt PHP Script


#1

Hi,
I am using Twitter OAuth For Auto Tweet in My PHP Account,
but unfortunately i cant get My Status Post…

I had tried Both method for status Updates but its not working,
Can you please help me for this,

Code which i am using is given below…

----------First Method using OAuth ----

$consumerKey    = 'MYCONSUMERKEY';
$consumerSecret = 'MYCONSUMERSECRET';
$oAuthToken     = 'MYAUTHTOKEN';
$oAuthSecret    = 'MYAUSECRET';

require_once('twitteroauth.php');

$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);

$tweet->post('statuses/update', array('status' => 'PHP auto post tweet to Twitter. Read more: http://www.blog.phpinfinite.com'));

When i am using this i didnt get any error but tweet is not post on my twitter account
---------------------END---------------------------

----------Second Method using CURL LIberary----

$username='MYUSERNAME';
$password='MYPASSWORD';
// The message you want to send
$message = ''PHP auto post tweet to Twitter. Read more: http://www.blog.phpinfinite.com';
// The twitter API address
$url='http://twitter.com/statuses/update.xml';
// Alternative JSON version
//$url = 'http://twitter.com/statuses/update.json';
// Set up and execute the curl process
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST,1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS,"status=".$message);
curl_setopt($curl_handle, CURLOPT_USERPWD,"$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
// check for success or failure
if (empty($buffer)) {
    echo 'Try again';
} else {
    echo 'success';
}

i got success message but the tweet is not post on my account

-------------END----------------------

Hope you Will Give me solution of this as soon as possble

Regards

Munir Vora
munirsunni@gmail.com
www.phpinfinite.com


#2

Make sure you understand how the libraries you’re using interact with the API. twitteroauth allows you to make requests to unversioned paths – you should make sure you’re instructing it to use https://api.twitter.com/1.1/statuses/update.json

Your second approach is to an outdated endpoint and using “basic auth” (username and password) which is not supported by the API.


#3

ññññññ


#4

لا يبدو انهو جيد