发送POST请求wget

时间:2013-06-11 17:57:04

标签: php linux post csv wget

我正在尝试保存具有dopostback链接的CSV文件。我目前有标题和cookie但没有获得带有wget的csv文件。

以下是标题:

http://pregame.com/sportsbook_spy/default.aspx

POST /sportsbook_spy/default.aspx HTTP/1.1
Host: pregame.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.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
Referer: http://pregame.com/sportsbook_spy/default.aspx
Cookie: Ccd=035ad31fe6ae4ecfa471cb7cb6f3a487b42fd4986df80e1a; Scd=0ad1b088c2c4b0097b3a7d3b32c34ec9d1585fde04336f0b; __utma=258943563.1458961190.1370891037.1370891037.1370970458.2; __utmz=258943563.1370891037.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __atuvc=8%7C24; __utmb=258943563.8.10.1370970458; ASP.NET_SessionId=hzk5pwlo3y3kdwuuybcxoliq; AuthorizationCookie=6688A75D-8B99-4CD2-80C5-595236C99E47; __utmc=258943563
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 1092
__EVENTTARGET=ctl00%24content%24ctl00%24w_9613%24_fffffffff60c1bf9%24ctl00%24lbDownload&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwUKMTgwNjUyODkwM2QYAQU%2BY3RsMDAkY29udGVudCRjdGwwMCR3Xzk2MTUkX2ZmZmZmZmZmZjYwYzFiZjkkY3RsMDAkZ3JkQ29tbWVudHMPPCsADAEIAgFk&ctl00%24header%24ctl00%24w_156%24_fffffffff60c1bf9%24ctl00%24Search1%24SearchText=&ctl00_header_ctl00_w_156__fffffffff60c1bf9_ctl00_Search1_filter=&ctl00%24content%24ctl00%24w_9613%24_fffffffff60c1bf9%24ctl00%24txtGameDt=06%2F11%2F2013&ctl00%24content%24ctl00%24w_9613%24_fffffffff60c1bf9%24ctl00%24hdnAllowDownload=1&ctl00%24content%24ctl00%24w_9613%24_fffffffff60c1bf9%24ctl00%24hfSport=all&ctl00%24content%24ctl00%24w_9613%24_fffffffff60c1bf9%24ctl00%24hfCal=0&ctl00%24content%24ctl00%24w_9615%24_fffffffff60c1bf9%24ctl00%24txtComment=&ctl00%24content%24ctl00%24w_9615%24_fffffffff60c1bf9%24ctl00%24hfParentId=0&ctl00%24content%24ctl00%24w_9615%24_fffffffff60c1bf9%24ctl00%24hfReplyId=0&ctl00%24content%24ctl00%24w_9615%24_fffffffff60c1bf9%24ctl00%24hfReportAbuse=0&ctl00%24content%24ctl00%24w_9615%24_fffffffff60c1bf9%24ctl00%24hfIsLoggedIn=0
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/csv; charset=utf-8
Content-Encoding: gzip
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
x-frame-options: SAMEORIGIN
Telligent-Evolution: 6.1.9.30500
Content-Disposition: attachment; filename=GameInfo.csv
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 11 Jun 2013 17:41:01 GMT
----------------------------------------------------------

对于我正在使用的命令

wget --load-cookies cookies.txt --post-file post-file http://pregame.com/sportsbook_spy/default.aspx

如何通过POST请求获取此CSV文件?

1 个答案:

答案 0 :(得分:-1)

尝试使用cUrl命令

curl -i -X POST http://pregame.com/sportsbook_spy/default.aspx -H "Content-Type: text/csv" --data-binary "@file.csv"

Send POST Request with Data Specified in File via Curl