找到一篇关于微博床图的文章
http://www.jianshu.com/p/55fd...
具体是用python来实现的
我想要在php下来实现,具体实现代码如下:
$post_data['pic1']=curl_file_create('d:/gg.jpg', 'image/jpeg', "gg.jpg");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://picupload.service.weibo.com/interface/pic_upload.php?mime=image%2Fjpeg&data=base64&url=0&markpos=1&logo=&nick=0&marks=1&app=miniblog");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
但一直失败,不知道为什么?
{"code":"A20001","data":{"count":-1,"data":"eyJhcHAiOiJtaW5pYmxvZyIsImNvdW50IjotMSwidGltZSI6MTQ4NjE5NzM4OC43NjMsInBpY3MiOnsicGljXzEiOnsicmV0IjotMSwibmFtZSI6InBpY18xIn19fQ==","pics":{"pic_1":{"ret":-1,"name":"pic_1"}}}}
1.$cookie内容来自:
2.$post_data['pic1']中的pic1来自:
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这个应该是你调用第三方接口,看官方文档吧