Twitter 用OAuth在推特上发送图片
我使用以下代码与OAuth一起推特图片。我在几个教程中发现了相同的代码,但是如果没有错误发生,我就无法让它工作Twitter 用OAuth在推特上发送图片,twitter,oauth,Twitter,Oauth,我使用以下代码与OAuth一起推特图片。我在几个教程中发现了相同的代码,但是如果没有错误发生,我就无法让它工作 <?php // Insert your keys/tokens $consumerKey = '***'; $consumerSecret = '***'; $OAuthToken = '***'; $OAuthSecret = '***'; // Full path to twitterOAuth.php (change OAuth to your own path) re
<?php
// Insert your keys/tokens
$consumerKey = '***';
$consumerSecret = '***';
$OAuthToken = '***';
$OAuthSecret = '***';
// Full path to twitterOAuth.php (change OAuth to your own path)
require_once('connect/twitter/twitteroauth.php');
$params = array(
'status' => 'Testing API http://google.com',
'media[]' => 'http://diit.cz/sites/default/files/google_chrome_logo.png'
);
// create new instance
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $OAuthToken, $OAuthSecret);
// Send tweet
$tweet->post('statuses/update', $params);
?>
只是想确定一下。$OAuthToken和$OAuthSecret是否应该从Twitter开发者复制?或者这些变量对于每个用户都不同
到目前为止,我已经检查了复制twitter密钥和机密的错误,检查了twitteroatuh.php文件是否正确链接,检查了我的twitter应用程序是否设置为读/写权限,检查了我的服务器上是否启用了cURL
执行此代码后,不会出现任何错误,也不会在我的Twitter上发布任何内容。媒体必须是本地图像-您不能简单地发布URL。你有没有试过在你的服务器上保存图片并发布?是的,我试过了。它在推特上显示测试结果,但没有图像