Copy code The code is as follows:
$url = "http://jb51.net /index.html";
$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);
echo $contents;
? >
http://www.bkjia.com/PHPjc/326749.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326749.htmlTechArticleCopy the code as follows: ?php $url = "http://jb51.net/index.html"; $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,...