試圖提交一個表單,捲曲都經由PHP和命令行發送。服務器的響應包含空內容(下面標題)。比響應不同CURL響應於請求,從瀏覽器
當相同的網址通過瀏覽器提交,響應由適當webapge的。
是否嘗試經由提交POST捲曲請求參數和經由每個下面的命令行卷曲標誌「-d」,「F」和「-G」的GET。
如果查詢串參數都貼有 「-d」 標誌,所得標題是:
HTTP/1.1 302暫時移動
日期:星期四,2011 02 6二十一點41分54秒GMT
服務器:Apache
Set-Cookie:JSESSIONID = DC5F435A96A353289F58593D54B89570;路徑=/XXXXXXX
P3P:CP = 「CAO PSA OUR」
位置:http://www.XXXXXXXX.com/
的Content-Length:0
連接:關閉
的Content-Type:text/html的;字符集= UTF-8
集-Cookie:XXXXXXXXXXXXXXXX = 1318103232.20480.0000;路徑=/
如果查詢串參數都貼有 「-F」 標誌,所得的標題是:
HTTP/1.1 100繼續
HTTP/1.1 500內部服務器錯誤
日期:星期四,2011年6月2日21時52分54秒GMT
服務器:Apache
的Content-Length:1677
連接:關閉
的Content-Type:text/html的;字符集= UTF-8
的Set-Cookie:XXXXXXXXXXXXXX = 1318103232.20480.0000;路徑=/
有所不同:接受編碼
<html><head><title>Apache Tomcat/5.5.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error() that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Servlet execution threw an exception<br>
</pre></p><p><b>root cause</b> <pre>java.lang.NoClassDefFoundError: com/oreilly/servlet/multipart/MultipartParser<br>
com.corsis.tuesday.servlet.mp.MPRequest.<init>(MPRequest.java:27)<br>
com.corsis.tuesday.servlet.mp.MPRequest.<init>(MPRequest.java:21)<br>
com.corsis.tuesday.servlet.TuesdayServlet.doPost(TuesdayServlet.java:494)<br>
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)<br>
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)<br>
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/5.5.26 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.26</h3></body></html>
問題:
什麼可能導致服務器根據捲曲請求的性質不同迴應。
如何成功地通過CURL提交申請?
可能是因爲CURL和PHP請求中的Accept標頭不同,或者可能是Expect標頭 - 可能是影響服務器響應方式的一系列因素。 Wireshark(http://www.wireshark.org/)是一個非常有用的調試工具,如果你可以捕捉你電腦上的內容,你就可以確定兩個請求之間的區別正在製作,這可能會有所幫助。 – 2011-06-02 22:14:43
將查看wireshark,但已經使用「-i」和「-v」verbose選項來查看HTTP頭部輸出;沒有幫助。還使用Firefox螢火蟲附加功能查看回應; ho幫助。 – Soph 2011-06-03 02:02:07