如何模拟PHP中的post动作?(蜘蛛)

时间:2015-11-24 06:25:37

标签: php web-crawler simple-html-dom

以下是html代码:

<form action="/download3.php" method="post">
   <input type="hidden" value="download" name="action">
   <input type="hidden" value="25036" name="id">
   <input type="hidden" value="7bfe3df68502dc18dfeeeb57" name="uhash">
   <input name="imageField" type="image" width="140" height="55" src="http://style.bttiantang.cc/style/download.gif" style="cursor:pointer;">
</form>

我使用 simple_html_dom 工具在操作 /download3.php 之前添加根网址。但它失败了。是否可以模拟下载操作?

我使用chrome控制台获取以下数据: 请求标题

POST /download1.php HTTP/1.1
Host: www.bttiantang.com
Connection: keep-alive
Content-Length: 87
Cache-Control: max-age=0
Accept:     text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://www.bttiantang.com
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://www.bttiantang.com/download.php?   n=%E7%9C%9F%E5%AE%9E%E9%AD%94%E9%AC%BC%E6%B8%B8%E6%88%8Fbt%E7%A7%8D%E5%AD%90%E4%B8%8B%E8%BD%BD.720p%E9%AB%98%E6%B8%85.torrent&temp=yes&id=27401&uhash=ca227452bb4cd1c889891f4d
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4
Cookie: bdshare_firstime=1445168249998; CNZZDATA5933609=cnzz_eid%3D1395728676-1445164396-%26ntime%3D1448345928; cscpvcouplet_fidx=1; _gat=1; CNZZDATA5934599=cnzz_eid%3D418137637-1445775850-http%253A%252F%252Fwww.bttiantang.com%252F%26ntime%3D1448342934; ftcpvcouplet_fidx=1; _ga=GA1.2.798224208.1445780740; 37cs_pidx=5; 37cs_user=37cs22052454365; CNZZDATA5934077=cnzz_eid%3D1512319301-1445775985-http%253A%252F%252Fwww.bttiantang.com%252F%26ntime%3D1448347062; cscpvrich_fidx=5; 37cs_pennding16053=true; CS_pending16053=true; 37cs_show=1%2C2%2C3%2C4%2C5

响应标题

HTTP/1.1 200 OK
Server: nginx/1.2.9
Date: Tue, 24 Nov 2015 06:42:59 GMT
Content-Type: application/octet-stream
Content-Length: 77019
Connection: keep-alive
X-Powered-By: PHP/5.2.17p1
Content-Encoding: none
Cache-Control: private
Content-Disposition: attachment;  
   filename="%E3%80%90BT%E5%A4%A9%E5%A0%82%E3%80%91%E3%80%90BTtiantang.com%E3%80%91[720p]%E7%9C%9F%E5%AE%9E%E9%AD%94%E9%AC%BC%E6%B8%B8%E6%88%8F.3.73GB.torrent"

我的请求标题 我找到了不同的,

Content-Length: 63
Cache-Control: max-age=0
Accept:   text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://localhost
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://localhost/weichat/download.php?link=/download.php?n=%E8%B6%85%E5%87%A1%E8%9C%98%E8%9B%9B%E4%BE%A02bt%E7%A7%8D%E5%AD%90%E4%B8%8B%E8%BD%BD.8%E6%9C%88%E6%9C%80%E6%96%B0720p%E9%AB%98%E6%B8%85%E5%AD%97%E5%B9%95%E7%89%88.torrent&temp=yes&id=25036&uhash=7bfe3df68502dc18dfeeeb57

Referer,Origin和Content-Length是不同的。 服务器是否可以检查Referer和Origin? 内容的哪些部分构成内容长度? 是否有可能改变3个人?

0 个答案:

没有答案