【发布时间】:2013-10-30 17:59:35
【问题描述】:
abraham 的 twitteroauth 库是否适用于 update_with_media?
我正在使用下面的代码,但它返回给我 stdClass 对象 ( [请求] => /1/statuses/update_with_media.json [error] => 创建状态时出错。 )
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
header('Location: ./clearsessions.php');
}
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,$_SESSION['access_token']['oauth_token'], $_SESSION['access_token']['oauth_token_secret']);
$image = './images/5298.png';
$content = $connection->post('statuses/update_with_media',
array(
'media[]' => '@{$image};type=image/jpeg;filename={$image}',
'status' => 'My current location'));
include('html.inc');
有人知道如何解决这个问题吗?
编辑1:我使用https://upload.twitter.com/1/作为网址
【问题讨论】:
-
据我所知,您不需要 ;type=image/jpeg;filename={$image} 如果您不使用它们,它会起作用吗?
-
不....没有它就不行
-
对于新的 Twitter 媒体上传检查这个解决方案:stackoverflow.com/questions/26340704/…
标签: php twitter twitter-oauth