0

大家好,我的站点地图生成器有问题,它在几千个 URL 上运行良好,但是当它到达 20000 个 URL 时,它开始出错,我还能做些什么来帮助防止这种情况

$request_url ="http://www.example.com";//put your url here
$url=str_replace("http://", "", $request_url); // i added this because to check if wwwdomain.com is in the url
$alllinks=array();// create an array for all the links
         $alllinks2=array();// create an array for all the links
          $alllinks3=array();// create an array for all the links
            $newUrl=array();// create an array for all the links
$badUrls=array("basket", "#" ,"mailto", "javascript:document", "reviews.php", "review.php","tab=",".JPG",".jpg","png","PNG","gif","GIF","item_id=","../", "pn_pr");// array of urls we dont want to include
$ch = curl_init(); //search for links
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL, $request_url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt ($ch,CURLOPT_VERBOSE,false);
curl_setopt($ch, CURLOPT_TIMEOUT, 900);
$result = curl_exec($ch);

谢谢

4

0 回答 0