免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5491 | 回复: 7
打印 上一主题 下一主题

问个模拟POST提交的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-11 09:24 |只看该作者 |倒序浏览
就是说如果我做了一个HTML页面,在本地运行,只要能够提交到远程一个接收页面的话.

那么用 fsockopen()或是curl()就一定可以模拟这种提交呢?

论坛徽章:
0
2 [报告]
发表于 2008-06-11 09:40 |只看该作者
不需要这么麻烦吧,伪造一个form就可以了
再不行就伪造包

论坛徽章:
0
3 [报告]
发表于 2008-06-11 10:36 |只看该作者
原帖由 sunnyfun 于 2008-6-11 09:40 发表
不需要这么麻烦吧,伪造一个form就可以了
再不行就伪造包



我主要想得到提交后的网页源代码,

而且伪造FORM的话,需要手工一次次的点击,还不是不行吗

论坛徽章:
0
4 [报告]
发表于 2008-06-11 10:44 |只看该作者

回复 #1 yanglei1979 的帖子

$allhtml = '';

$fp = fsockopen ("www.baidu.com", 80, $errno, $errstr, 30);

$outurl = "GET / HTTP/1.1\r\n";
$outurl .= "Host: www.baidu.com\r\n";
$outurl .= "Connection: Close\r\n\r\n";

fwrite ($fp, $outurl);

while (!feof($fp))
{
        $html =  fgets ($fp, 12;
        $allhtml .= $html;
}

echo $allhtml;
               
fclose ($fp);

[ 本帖最后由 elog 于 2008-6-11 10:47 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2008-06-11 10:53 |只看该作者
原帖由 elog 于 2008-6-11 10:44 发表
$allhtml = '';

$fp = fsockopen ("www.baidu.com", 80, $errno, $errstr, 30);

$outurl = "GET / HTTP/1.1\r\n";
$outurl .= "Host: www.baidu.com\r\n";
$outurl .= "Connection: Close\r\n\r\n";

...

非常感谢,我想模拟这个POST

  1. <form action="http://contact.ebay.com/ws/eBayISAPI.dll" class="nomargin" method="post" name="InlineSelfHelpWebform" style="margin: 0px; padding: 0px;"><input name="MfcISAPICommand" value="ContactUs" type="hidden"><input name="wftype" value="2023" type="hidden"><input name="rcode" value="LP=C00142" type="hidden"><input name="subject" value="Excessive shipping and handling" type="hidden"><input name="bcrumb" value="Listing Violations &gt; Listing policy violations (improper keywords, outside links, excessive shipping,&nbsp;etc) &gt; Circumvention of eBay fees &gt; Excessive shipping and handling" type="hidden">
  2. <input type="submit" name="submit" value="Email us with your question or concern"></form>
复制代码


请问该如何写 fsockopen()?

论坛徽章:
0
6 [报告]
发表于 2008-06-11 10:56 |只看该作者
  1. <?php
  2. $ff='';
  3. $out='';
  4. $fp = fsockopen("contact.ebay.com", 80, $errno, $errstr, 30);
  5. if (!$fp) {
  6.     echo "$errstr ($errno)<br />\n";
  7. } else {
  8. $rcode="LP=C00142";
  9. $subject="Excessive shipping and handling";
  10. $dsturl="http://cgi.ebay.com/2gb-1-8-mp4-mp3-video-fm-voice-player-silver-warranty_w0qqitemz380032645037qqihz025qqcategoryz98410qqsspagenamezwdvwqqrdz1qqcmdzviewitem";
  11. $bcrumb="Listing Violations &gt; Listing policy violations (improper keywords, outside links, excessive shipping,&nbsp;etc) &gt; Circumvention of eBay fees &gt; Excessive shipping and handling";





  12. $params="MfcISAPICommand=ContactUs&wftype=2023&rcode=$rcode&subject=$subject&dsturl=$dsturl&bcrumb=$bcrumb&item=380032645037";
  13. $length = strlen($params);
  14.     $out = "POST /ws/eBayISAPI.dll  HTTP/1.1\r\n";
  15.     $out .= "Host: contact.ebay.com\r\n";
  16.        
  17. $out .= "Cookie: dp1=ba1p/0484f93b6^pbf/-21463039964a2f75b6^fm/5.3.24875b23e^tzo/-1e0484e5046^mpc/0485b7136^pcid/10910931984a2f75b6^kms/in4c10a936^u1p/eWFuZ2xlaTE5Nzk*4a2f75b6^; nonsession=BAQAAARpvxZqEAAaAAEAAC0ovdbZ5YW5nbGVpMTk3OQAzAApKL3W2NTE4MTEyLENITgAQAAtKL3W2eWFuZ2xlaTE5NzkAywABSE5JPjQABAALSi91tnlhbmdsZWkxOTc5AMoAIFG0Q7Y3MTFiZDk3NDExYTBhMDkwYzY2NDliZTRmZmVhYzkxMACdAAhKL3W2MDAwMDAwMDEAnAA4Si91tm5ZK3NIWjJQckJtZGo2d1ZuWStzRVoyUHJBMmRqNndGbEl1b0RaU0dwd2lkajZ4OW5ZK3NlUT09APMAIkovdbYkMiRtT3RYalRMbiQ0alhJb0hjL1JsYzlpYWtDNHFSbkwwAPIAC0hPd/AxLjE0OTk1NDQ2NACaAAxIT3a+eWFuZ2xlaTE5NzlvRtKhoWsFR+8I3eh+3R2LpAkIUNA*; cid=VnEO6b0ltroKQFBw%231091093198; lucky9=9515757; ns1=BAQAAARpvxZqEAAaAAKUADEovWM4xNDk5NTQ0NjQvMDsJ37g3MLzh7scmxFEKfXbAFROEwA**; shs=BAQAAARpvxZqEAAaAAVUADUhXX74xNzY2NzUyNzAwNCwyKEve+mZpGp6x/q0fy02E8FpeQec*\r\n";

  18. $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
  19. $out .= "Content-Length: ".$length."\r\n";  
  20.    
  21.         $out .= $params."\r\n";
  22. $out .= "Connection: Close\r\n\r\n";
  23.     fwrite($fp, $out);
  24.     while (!feof($fp)) {
  25.        $ff=$ff.fgets($fp, 128);
  26.            echo fgets($fp, 128);
  27.     }
  28.     fclose($fp);
  29.        
  30.         echo $ff;
  31.         }
  32. ?>
复制代码


上面是我写的代码,但是不行,提交过去一直显示 connect close

用FORM手工提交就可以。

听说用WEBBROWSER对象可以搞定,谁知道怎么搞的?

论坛徽章:
0
7 [报告]
发表于 2008-06-12 16:43 |只看该作者

  1. <form action="http://contact.ebay.com/ws/eBayISAPI.dll" class="nomargin" method="post" name="InlineSelfHelpWebform" style="margin: 0px; padding: 0px;"><input name="MfcISAPICommand" value="ContactUs" type="hidden"><input name="wftype" value="2023" type="hidden"><input name="rcode" value="LP=C00142" type="hidden"><input name="subject" value="Excessive shipping and handling" type="hidden"><input name="bcrumb" value="Listing Violations &gt; Listing policy violations (improper keywords, outside links, excessive shipping,&nbsp;etc) &gt; Circumvention of eBay fees &gt; Excessive shipping and handling" type="hidden">
  2. <input type="submit" name="submit" value="Email us with your question or concern"></form>
复制代码


上面的这个FORM你从哪个URL取得的.贴一下那个URL

论坛徽章:
0
8 [报告]
发表于 2008-06-12 17:46 |只看该作者
原帖由 bjbs_270 于 2008-6-12 16:43 发表





上面的这个FORM你从哪个URL取得的.贴一下那个URL

多谢,是这个地址
http://pages.ebay.com/help/conta ... ntinue=Continue+%3E
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP