php - 如何使用 TwitterOAuth PHP 编写推文?
问题描述
我想用我的应用程序 twitter 写一条推文,使用twitterOAuth
. 我的代码可以编写推文,但是有一个错误(我不知道在哪里)破坏了我的代码。也许我使用的是旧版本的twitterOAuth
My code is this:
// 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) {
print_r('<br>Error try again<br>');
}
else{
print_r('<br>Notifica twitter funziona<br>');
}
print_r('OK');
代码写推文但不在print_r
内部if 语句和最后 **print_r('OK');
你能告诉我这段代码是否正确吗?我在哪里可以下载正确的版本twitterOAuth
?
在我的文件中twitterOAuth
有
require_once('OAuth.php');
可能'OAuth.php'
是老了……
非常感谢,对不起我的英语
解决方案
推荐阅读
- flutter - 如何在颤振中实现这种类型的自定义标签设计?
- r - 将非英语数据从 SQL Server 导入到 R
- mysql - MySQL - 如何按名称排序,然后按字母数字有选择地在表上?
- javascript - 正则表达式 - 或 _ 在字符串的开头或结尾
- python - AWS 更新项目错误 - UpdateItem 操作:提供的关键元素与架构不匹配
- sapui5 - DPC 类被触发两次
- java - Acitvemq 连接到 RHEL7.6 机器超时
- c# - 如何在通用存储库模式 Mvc.Net 实体框架中实现级联下拉列表?
- oracle - oracle数据库中如何压缩所有表
- laravel - 在 laravel 中自定义“can”函数