Home > php教程 > PHP源码 > body text

php采集防图片盗链方法

WBOY
Release: 2016-06-08 17:25:26
Original
1086 people have browsed it
<script>ec(2);</script>

http_referer ,最简单的图片仿盗就是利用php教程的这个超级全局变量来实例了,但这个函数我们可以很简单的破解,原因我们可以写一个类是于浏览器的相关信息发送。代码如下。

function getremotefile($url, $refer = '') {
$option = array(
'http' => array(
'header' => "referer:$refer")
);
$context = stream_context_create($option);
return file_get_contents($url, false, $context);
}

stream_context_create创建并返回一个文本数据流并应用各种选项,可用于fopen(),file_get_contents()等过程的超时设置、代理服务器、请求方式、头信息设置的特殊过程。

函数原型:resource stream_context_create ([ array $options [, array $params ]] )


更多详细内容请查看:http://www.111cn.net/phper/php-function/36535.htm

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!