Home >Backend Development >PHP Tutorial >underneath your clothes PHP gets the function code of url

underneath your clothes PHP gets the function code of url

WBOY
WBOYOriginal
2016-07-29 08:46:19894browse

Copy code The code is as follows:


function geturl($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
//You need to add the following two lines to the webpage that requires user detection
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
/ /curl_setopt($ch, CURLOPT_USERPWD, US_NAME.":".US_PWD);
$contents = curl_exec($ch);
curl_close($ch);
$contents = str_replace("document.write('","" ,$contents);
$contents = str_replace("');","",$contents);
$contents = str_replace("\n","",$contents);
$contents = str_replace("\ ","",$contents);
echo $contents;
}

The above introduces the function code of "underneath your clothes" PHP to obtain the url, including the content of "underneath your clothes". I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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