簡體   English   中英

使用子域爬網.net網站

[英]Crawling an .net site with subdomain

我正在嘗試使用php curl爬行.net網站。 我要抓取的網站是

http://waltham.patriotproperties.com

我能夠抓取該網站。

但是當我嘗試抓取內部頁面時

http://waltham.patriotproperties.com/about.asp

或該子域內的任何其他頁面,它給我以下錯誤

The page cannot be displayed because an internal server error has occurred.1

我正在使用的代碼如下

$ch = curl_init();
$urlLogin   =   "http://www.waltham.patriotproperties.com";
curl_setopt($ch, CURLOPT_URL, $urlLogin);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

//curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 

$data = curl_exec($ch);
echo $data; 

該代碼適用於

http://waltham.patriotproperties.com/

但不適用於

http://waltham.patriotproperties.com/search.asp
http://waltham.patriotproperties.com/summary.asp

即該子域內的任何網址。 我在子域內使用url得到的錯誤是

HTTP/1.1 500 Internal Server Error
Content-Type: text/html
Server: Microsoft-IIS/7.5
Date: Wed, 05 Jun 2013 16:33:57 GMT
Content-Length: 75 

您將從以下位置開始:

$urlLogin   =   "http://www.waltham.patriotproperties.com";

但是搜索頁面的鏈接位於:

http://waltham.patriotproperties.com/search.asp

如果您瀏覽該URL,您將看到內容。 如果您添加www. 到URL的開頭,它可以正常工作。

編輯添加 -如果他們有可以使用的API,這將變得容易得多

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM