京东免费图床上传接口代码PHP源码
要论哪里的图床最稳定,就一定要说到目前主流的新浪,京东,淘宝,百度,搜狗,360图床了。
不过一般来说 还是京东,淘宝的比较稳定!稳定就是代表你的图片上传后不会被删除也不会出现打不开404等情况。
下面附上京东图床PHP上传代码供大家学习参考。
200, 'imgurl'=>'https://img'.rand(10,14).'.360buyimg.com/uba/'.$matches\[1\] ); exit(json\_encode($arr)); function get\_curl($url, $post=0, $referer=0, $cookie=0, $header=0, $ua=0, $nobaody=0){ $ch = curl\_init(); curl\_setopt($ch, CURLOPT\_URL, $url); curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER, false); curl\_setopt($ch, CURLOPT\_SSL\_VERIFYHOST, false); $httpheader\[\] = "Accept:application/json"; $httpheader\[\] = "Accept-Encoding:gzip,deflate,sdch"; $httpheader\[\] = "Accept-Language:zh-CN,zh;q=0.8"; $httpheader\[\] = "Connection:close"; curl\_setopt($ch, CURLOPT\_HTTPHEADER, $httpheader); if ($post) { curl\_setopt($ch, CURLOPT\_POST, 1); curl\_setopt($ch, CURLOPT\_POSTFIELDS, $post); } if ($header) { curl\_setopt($ch, CURLOPT\_HEADER, true); } if ($cookie) { curl\_setopt($ch, CURLOPT\_COOKIE, $cookie); } if($referer){ if($referer==1){ curl\_setopt($ch, CURLOPT\_REFERER, 'http://m.qzone.com/infocenter?g\_f='); }else{ curl\_setopt($ch, CURLOPT\_REFERER, $referer); } } if ($ua) { curl\_setopt($ch, CURLOPT\_USERAGENT, $ua); } else { curl\_setopt($ch, CURLOPT\_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC\_One\_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0"); } if ($nobaody) { curl\_setopt($ch, CURLOPT\_NOBODY, 1); } curl\_setopt($ch, CURLOPT\_TIMEOUT, 3); curl\_setopt($ch, CURLOPT\_ENCODING, "gzip"); curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1); $ret = curl\_exec($ch); curl\_close($ch); return $ret; }本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 汐岑小窝!
评论
ValineGitalk