蓝叶分享猎豹图床接口php代码
一串php代码上传图片到猎豹浏览器的一个图片接口上,可以作为临时图床用,复制蓝叶分享猎豹图床接口php代码到php文件里,在同级目录放上需要上传的图片,运行php文件就可以上传图片了,成功显示图片地址,动手能力强的可以写个js代码无刷新上传。
此php代码仅供学习测试,请勿上传非法图片。
<?php //123.jpg放在php文件同级目录 $imgpath = dirname(__FILE__).'/123.jpg'; $curl = curl_init(); $data = array('img'=>new CURLFile($imgpath)); curl_setopt($curl, CURLOPT_URL, "http://store.liebao.cn/game/screenshot/postImage.php"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER'); $result = curl_exec($curl);curl_close($curl); $imgdat = json_decode($result); $url = $imgdat->url; echo $url; ?>
- 版权申明:此文如未标注转载均为本站原创,自由转载请表明出处《蓝叶》。
- 本文网址:https://lanye.org/web/935.html
- 上篇文章:emlog蓝叶导航菜单图标插件
- 下篇文章:蓝叶分享西瓜视频地址解析php代码