http发帖请求卷曲

时间:2015-04-02 19:44:49

标签: http curl http-post httprequest

我有这个网站,我发了一个http发帖请求 http://requestmaker.com/

我的问题是如何使用curl或其他类似的命令行应用程序提出此请求? Windows或Linux并不重要。

我的请求网址如下:

http://www.website.net/servers?server%5Bgame%5D=cstrike1&server%5Bdomain%5D=192.168.1.1&server%5Bport%5D=27000

请求标题:

Content-Type: application/json
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Refer: http://www.website.net/servers/new

1 个答案:

答案 0 :(得分:1)

那将是:

curl -H "Content-Type: application/json" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" -H "Accept-Encoding: gzip, deflate" -H "Refer: http://www.website.net/servers/new" "http://www.website.net/servers?server%5Bgame%5D=cstrike1&server%5Bdomain%5D=192.168.1.1&server%5Bport%5D=27000"

但我认为你的意思是设置Referer标题而不是Refer,因为Content-Typeapplication/json,你可能应该POST POST JSON数据。