新浪微博图床API

主要就是这段代码,找了老半天才找到,直接拿去用吧:


function uploadpic($picurl,$cookie){
$ch = curl_init('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_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_VERBOSE => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Cookie: $cookie"],
    CURLOPT_POSTFIELDS => ['b64_data' => base64_encode(file_get_contents($picurl))],
]);

$res = curl_exec($ch);
curl_close($ch);
print_r($res);	



}
//上传图片到新浪 */



文章来源:微信群二维码

展开阅读全文

没有更多推荐了,返回首页