Many novice PHP in the development of their own site collection function will be directly used to file_get_contents to read or fopen, yes, we download the collection function to strengthen a little bit is to each other's anti-theft chain can not prevent the collection function.
Many novice PHP in the development of their own site collection function will be directly used to file_get_contents to read or fopen, yes, we download the collection function to strengthen a little bit is to each other's anti-theft chain can not prevent the collection function.
function Retrieveurlcontentbysocket ($url,
$host = "",
$port = 80,
$timeout =30) {
if ($host = = "") {
if (! ( $pos = Strpos ($url, '://'))) {
return false;
}
$host = substr ($url,
$pos +3,
Strpos ($url, '/', $pos +3)-$pos-3);
$uri = substr ($url, Strpos ($url, '/', $pos +3));
}
else{
$uri = $url;
}
$request = "GET". $uri. " Http/1.0rn "
." Host: ". $host." Rn
." Accept: */*rn "
." User-agent:zealgetrn "
." RN ";
$sHnd = @fsockopen ($host, $port, $errno, $errstr, $timeout);
if (! $sHnd) {
return false;
}
@fputs ($sHnd, $request);
Get Source
$result = "";
while (!feof ($sHnd)) {
$result. = Fgets ($sHnd, 4096);
}
Fclose ($SHND);
$headerend = Strpos ($result, "rnrn");
if (Is_bool ($headerend))
{
return $result;
}
else{
Return substr ($result, $headerend +4);
}
http://www.bkjia.com/PHPjc/445057.html www.bkjia.com true http://www.bkjia.com/PHPjc/445057.html techarticle many novice PHP in the development of their own site collection function will be directly used to file_get_contents to read or fopen Yes, yes, we download the acquisition function to strengthen a little bit is to each other ...