Home >Backend Development >PHP Tutorial >underneath your clothes PHP gets the function code of url
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.