1
我正在爲mIRC編寫一個腳本,它將從我的網絡服務器獲取數據,該代碼是通過PHP生成的。當通過套接字連接時,PHP代碼不會「編譯」
當我通過瀏覽器(firefox)連接時,它工作的很好。 但是,當我通過mIRC套接字連接時,服務器無法「編譯」我的PHP代碼。我仍然可以獲取任何其他文本或HTML。好像web服務器(的Litespeed)不承認我的http請求(?!)
這是我傳遞給服務器我的頭信息:
sockwrite -n ccsw_sock_reg GET /ccsw/ccsw.php?action=register&username= $+ %ccsw_username_temp $+ &password= $+ %ccsw_username_temp HTTP/1.1
sockwrite -n ccsw_sock_reg Host: www.[HIDDEN].com
sockwrite -n ccsw_sock_reg Connection: close
sockwrite -n ccsw_sock_reg User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9) Gecko/2008052906 Firefox/3.0
sockwrite -n ccsw_sock_reg Accept-Encoding: gzip
sockwrite -n ccsw_sock_reg Accept:Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
sockwrite -n ccsw_sock_reg Accept-Language: en-us,en;q=0.5
sockwrite -n ccsw_sock_reg Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7
;sockwrite -n ccsw_sock_reg Cache-Control: no-cache
sockwrite -n ccsw_sock_reg Cache-Control: no-store, no-cache, must-revalidate
sockwrite -n ccsw_sock_reg Cache-Control: post-check=0, pre-check=0
sockwrite -n ccsw_sock_reg Pragma: no-cache
sockwrite -n ccsw_sock_reg $crlf
我使用的Apache服務器,而不是試圖litespeed,但它也沒有解決。我仍然沒有得到任何PHP生成的代碼來顯示。
我是否缺少一些標題?我應該以完全不同的方式去做嗎?
更新:
的mIRC代碼:
alias testsock {
sockclose testsock
sockopen testsock www.[HIDDEN].com 80
}
on *:sockopen:testsock: {
sockwrite -nt testsock GET /ccsw/ccsw.php?action=register&username= $+ %ccsw_username_temp $+ &password= $+ %ccsw_username_temp HTTP/1.0
sockwrite -nt testsock Host: www.[HIDDEN].com
sockwrite -nt testsock $crlf
}
on *:sockread:testsock: {
%ccsw_content_start = 0
if ($sockerr > 0) return
sockread %temp
while ($sockbr) {
echo response: %temp
sockread %temp
}
}
響應:
reponse: HTTP/1.0 200 OK
reponse: Date: Thu, 02 May 2013 14:45:07 GMT
reponse: Server: LiteSpeed
reponse: Connection: close
reponse: X-Powered-By: PHP/5.2.17
reponse: Content-Type: text/html
reponse: Content-Length: 43
reponse:
後,去年 「的回覆:」 我應該得到與「效應初探一個PHP生成線:真「 」響應:「只是我的回聲的前綴..
你請求一個PHP文件時,會得到什麼迴應?一個錯誤?斷開連接? PHP的源代碼?你有沒有檢查你的日誌(包括Apache和PHP日誌)? – 2013-05-02 12:15:02
你有沒有注意到你在第6行有'Accept:Accept:'兩次? – 2013-05-02 12:17:02
第一站應該始終是Web服務器的訪問日誌和錯誤日誌。特別是Apache日誌*所有可能相關的東西,第一個成功,第二個失敗。 – 2013-05-02 12:29:06