使用php将图像发布到twitter不起作用
使用php将图像发布到twitter不起作用。请检查我的密码使用php将图像发布到twitter不起作用,php,twitter,Php,Twitter,使用php将图像发布到twitter不起作用。请检查我的密码 <? define( 'YOUR_CONSUMER_KEY' , '######################'); define( 'YOUR_CONSUMER_SECRET' , '######################'); require ('../../twitt/tmhOAuth.php'); require ('../../twitt/tmhUtilities.php'); $tmhOAuth = ne
<?
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);
?>
它不起作用。我总是返回0。此代码中的问题是什么?任何人请帮帮我……我想你是在尝试,但我看到的唯一区别是你使用$image='Tulips.jpg';它们在解析为当前目录的映像路径中包括。试试$image='./Tulips.jpg';调试您的代码,检查每个值,检查PHP错误日志。@HugoDelsing我用那个路径试过了。它不起作用。@Jocelyn值是正确的,问题在于twitter发布。