2017-01-09 124 views
1

在這裏我有http GET請求。從GET到POST轉換(原始)請求

GET http://www.uw-team.org/hm3next/loguj.php HTTP/1.1 
Host: www.uw-team.org 
Proxy-Connection: keep-alive 
Pragma: no-cache 
Cache-Control: no-cache 
Upgrade-Insecure-Requests: 1 
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 
Accept-Encoding: gzip, deflate, sdch 
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4 

我想將此請求從GET轉換爲POST方法,並在請求正文中添加一些參數。所以我改變了第一線,從

GET http://www.uw-team.org/hm3next/loguj.php HTTP/1.1 

POST http://www.uw-team.org/hm3next/loguj.php HTTP/1.1 

,並添加請求體:

... 
Accept-Encoding: gzip, deflate, sdch 
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4 

param1=val&param2=val2 

我有什麼改變/添加別的嗎?

回答

0

對於請求主體,添加:

Content-Type: application/x-www-form-urlencoded 

這就是你所需要的。

看到更多信息關於POST methodapplication/x-www-form-urlencoded

+0

我只會添加,在我的情況下還需要該標題:內容長度:64 –

+0

@MrocznyArturek啊,是的。我最近發現Apache不需要'Content-Length'。出於某種原因,我認爲你也在使用Apache。你有'411長度要求'嗎? – Rei