python脚本来模拟GET请求+接收结果

时间:2011-01-08 09:11:28

标签: python bash get request

如何制作脚本来模拟GET请求+接收结果 所以发送此请求但也能够收到答案 在python bash或php等

GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/2004 1107 Firefox/1.0
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: close

1 个答案:

答案 0 :(得分:0)

你可以在bash中使用curl

curl -H "Accept-Language: en-us,en;q=0.5" -H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" ... [url]

有用的选项:

  • - keepalive-time