我安裝了Apache 2.2。我可以使用Firefox的127.0.0.1或192.168.1.7加載本地網頁。 (我正在加載的網頁存儲在我的硬盤上。)當我嘗試使用VBScript訪問這些地址時,它不起作用。如果我使用VBScript訪問網絡,它可以正常工作,包括如果我在域名中使用IP地址。爲什麼Apache將本地服務於Firefox,而不是VBScript?
這裏是VBScript不能在本地服務的文件上工作,但會在互聯網上的相同文件上工作。 (如果我使用127.0.0.1或192.168.1.7,則將「錯誤」寫入文件)此腳本將網頁上的所有URL寫入文本文件。
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)
' The Chilkat Spider component/library is free.
set spider = CreateObject("Chilkat.Spider")
spider.Initialize "http://192.168.1.7/index.htm"
spider.AddUnspidered "http://192.168.1.7/index.htm"
success = spider.CrawlNext()
if success then
For i = 0 To spider.NumOutboundLinks - 1
outFile.WriteLine(spider.GetOutboundLink(i))
Next
else
outFile.WriteLine("Error.")
end if
以下是一些Apache訪問日誌。
Apache's log, running the VBScript (http://192.168.1.7/index.htm)
... GET /robots.txt HTTP/1.1" 404 208
... GET /index.htm HTTP/1.1" 200 365184
... GET /index.htm HTTP/1.1" 200 365184
Apache's log, loading the same from Firefox
... GET /index.htm HTTP/1.1" 200 365184
... GET /index_files/rsAItRhddGWakWTu2xcFYn5VJXiw_002.txt HTTP/1.1" 200 533363
... (additional accesses, with 200 and then different numbers)
關於此日誌,本地保存的文件是Google搜索結果頁面。 (對於測試,我不會將此用於Google。)VBScript將在實時互聯網版本上運行,但不會在本地提供副本。 Firefox會加載本地提供的文件,並且它看起來與現場文件完全相同。
我的防火牆已關閉。 Apache 2.2; Windows XP SP3
不Apache的訪問日誌說明了什麼?你能夠獲得HTTP狀態碼嗎? – 2013-03-07 02:45:45
@StevenVondruska我在最後將Apache日誌添加到了問題描述中。 – user199340 2013-03-07 18:57:58