当前位置:首页 > PHP >

此图片来自微信公众平台未经允许不可引用的PHP伪造来源解决办法

时间:2020-04-15 21:21:32浏览:267 转载

建个php文件:


<?php
$url = $_GET["url"];
$ch = curl_init();
$httpheader = array(
 'Host' => 'mmbiz.qpic.cn',
 'Connection' => 'keep-alive',
 'Pragma' => 'no-cache',
 'Cache-Control' => 'no-cache',
 'Accept' => 'textml,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8',
 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36',
 'Accept-Encoding' => 'gzip, deflate, sdch',
 'Accept-Language' => 'zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4'
);
$options = array(
 CURLOPT_HTTPHEADER => $httpheader,
 CURLOPT_URL => $url,
 CURLOPT_TIMEOUT => 5,
 CURLOPT_FOLLOWLOCATION => 1,
 CURLOPT_RETURNTRANSFER => true
);
curl_setopt_array( $ch , $options );
$result = curl_exec( $ch );
curl_close($ch);
header('Content-type: image/jpg');
echo $result;
exit;
?>

怎么使用??

http://www.mysite.com/xx.php?url=图片地址



上一篇:php过滤emoji表情
下一篇:如何将存储在七牛云中的图片批量下载到本地?

发表评论

昵称:  验证码:

关于博主

博主

博主:BlueCode

职业:web程序

简介:2002年开始一直从事Web制作,网站运营,会PHP+MYSQL ASP+MSSQL,微信开发