在我的Twitter上发布我的直接网站的新闻

时间:2016-02-03 11:13:15

标签: twitter oauth twitter-oauth

我制作此代码以在我的Twitter上发布我的直接网站的新闻,但是无法正常工作,无法识别错误,因为它不会返回任何内容。不起作用也没有错误,没有任何反应。我搜索了很多地方但找不到解决办法。有人能帮助我吗?

$resultado = 'Publicar no Twitter';

 require_once 'twitteroauth.php';

 define("CONSUMER_KEY","XXXXXXXXXXXXXXXXXXXXXXXXXX");
 define("CONSUMER_SECRET","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
 define("OAUTH_TOKEN","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
 define("OAUTH_SECRET","XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

 $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN,   OAUTH_SECRET);
 $content = $connection->get('account/verify_credentials');
 $connection->post('statuses/update', array('status' => $resultado));

1 个答案:

答案 0 :(得分:3)

To see the error replace the last line with:

$response =  $connection->post('statuses/update', array('status' =>
$resultado));

and add another line

var_dump($response);

then go back and tell here what it says