2012-04-17 51 views
2

我想用“照片U​​RL”更新twitter状态。使用Twitter上传,update_with_media API和curl

这里是我的代码:

curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'POST'); 
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE); 
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($ci, CURLOPT_URL, 'https://upload.twitter.com/1/statuses/update_with_media.json'); 
curl_setopt($ci, CURLOPT_VERBOSE, FALSE); 


curl_setopt($ci, CURLOPT_POSTFIELDS, array('media'=> '@http://sample.com/image.jpg', 'status'=>'This is a test image!')); 
//'media' =>'@http://sample.com/image.jpg;type=image/jpeg;filename=image.jpg' doesn't work, too 

$response = curl_exec($ci); 

我也尝试使用apigee但没有成功click here to test it!

PS:我不想用tmhOAuth类!

+0

我在找同样的东西,你找到了解决方案吗? – 2012-10-21 00:38:38

+0

对此的任何解决方案?我看到它已经很老了,仍然没有答案... – tg2007 2014-05-16 23:49:28

回答

0

最后,

我被迫使用预制的图书馆只是图片上传: https://github.com/themattharris/tmhOAuth

您可以验证变量播种了。如果您真的想要,您仍然可以使用自己的代码来处理其他API请求。

相关问题