使用php无法正常将图像发布到Twitter

时间:2013-03-20 11:22:59

标签: php twitter

使用php无法正常发布图片到Twitter请检查我的代码。

<?
define( 'YOUR_CONSUMER_KEY' , '######################');
define( 'YOUR_CONSUMER_SECRET' , '######################');

require ('../../twitt/tmhOAuth.php');
require ('../../twitt/tmhUtilities.php');

$tmhOAuth = new tmhOAuth(array(
         'consumer_key'    => "######################",
         'consumer_secret' => "######################",
         'user_token'      => "######################",
         'user_secret'     => "######################",
));

$image = 'Tulips.jpg';

$code = $tmhOAuth->request( 'POST','https://upload.twitter.com/1/statuses/update_with_media.json',
   array(
        'media[]'  => "@{$image};",
        'status'   => 'message text written here',
   ),
    true, // use auth
    true  // multipart
);

if ($code == 200){
   tmhUtilities::pr(json_decode($tmhOAuth->response['response']));
}else{
   tmhUtilities::pr($tmhOAuth->response['response']);
}
print_r($code);

&GT;

它不起作用。我总是返回0.这段代码有什么问题?有人请帮助我....

0 个答案:

没有答案