Php 用“写一条推文”;twitterOAuth“;返回错误

Php 用“写一条推文”;twitterOAuth“;返回错误,php,debugging,twitter,bots,twitter-oauth,Php,Debugging,Twitter,Bots,Twitter Oauth,我有这个问题,很多天我都在努力解决它 我用twitterOAuth写推特 // OAuth To Twitter require_once 'files-notifiche-twitter/twitteroauth.php'; // Do NOT Share (sono i token) define("CONSUMER_KEY", "xxx"); define("CONSUMER_SECRET", "xxx"); define("OAUTH_TOKEN", "xxx"); define("O

我有这个问题,很多天我都在努力解决它

我用twitterOAuth写推特

// OAuth To Twitter
require_once 'files-notifiche-twitter/twitteroauth.php';

// Do NOT Share (sono i token)
define("CONSUMER_KEY", "xxx");
define("CONSUMER_SECRET", "xxx");
define("OAUTH_TOKEN", "xxx");
define("OAUTH_SECRET", "xxx");

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


if ($connection->getLastHttpCode() != 200) {    //se non è riuscito a scrivere il tweet riprova
    print_r('<br>Error try again<br>');     
} 
else{
    print_r('<br>Notifica twitter funziona<br>');
}

print_r('OK');
//OAuth到Twitter
需要_once“files notifiche twitter/twitterouth.php”;
//不共享(sono i令牌)
定义(“消费者密钥”、“xxx”);
定义(“消费者秘密”、“xxx”);
定义(“OAUTH_令牌”、“xxx”);
定义(“OAUTH_秘密”、“xxx”);
//发布到Twitter
$connection=newTwitterOAuth(使用者密钥、使用者密钥、OAUTH令牌、OAUTH密钥);
$content=$connection->get('account/verify_-credentials');
$connection->post('status/update',array('status'=>'tweet');
如果($connection->getLastHttpCode()!=200){//se nonèriuscito a scrivere il tweet riprova
打印(“
错误重试”
”); } 否则{ 打印(“
推特快讯”
”); } 打印(“OK”);
此代码用于编写tweet,但在最后一部分中,是如何出现错误的……如果语句未写入,则执行
print\r
中的。 最后一次
print_r('OK')也一样

有东西破坏了我的密码,我不明白是什么


你能帮我吗?

你是在命令行
php你的php文件.php中运行这段代码吗?@JaredChu不……每隔2分钟一个cronjob运行我的代码。你认为错误在哪里?我想重现错误,所以我必须知道你的做法是的,你是对的。。。也许我使用的是twitterOAuth或OAuth.php的旧版本?(在twitterOAuth中有一个require_once('OAuth.php')可能很旧)我在github上读到了创建此方法的Abraham Williams的简介,但我不知道文件在哪里,也不知道如何使用github。我不是英国人,对我来说很难