Then if you consider the measures to break the chain of anti-theft, you need to consider the http_referer above the tamper. The corresponding variable in the PHP script is $_server[' Http_referer ', which stores the Http_referer value.
Because the direct access target URL resource has been blocked by the above anti-theft chain measures, so we need a similar gateway to get the thing. The plain thing is to write a PHP script that has been wrapped in HTTP headers.
Here's a simple function implementation:
Copy CodeThe code is as follows:
function Getremotefile ($url, $refer = ' ") {
$option = Array (
' http ' => array (
' Header ' => "Referer: $refer")
);
$context = Stream_context_create ($option);
Return file_get_contents ($url, False, $context);
}
This is a simpler function, which is to forge Referer (using the Stream_context_create function) and then get the data from each other (using file_get_contents, you need to turn on allow_url_fopen).
If you want to be "complex", you can use the sockets extension, which is not within the scope of this discussion.
In addition, provide a regular function to get the host name
Copy Code code as follows:
function GetHost ($url) {
$result = Preg_match ('/^http:\/\/[\d\w\.] +) \//', $url, $matches);
if (sizeof ($matches) >= 2) {
return $matches [1];
} else {
return null;
}
}
Further extensions can be encapsulated into scripts and then, for example, call
Http://127.0.0.1/proxy.php?url=http://i.am/img will be able to access the links that unlock the chain of action (and then use Javascript to replace all of the picture links).