curl脚本只是填写表单不提交它 [英] curl script just filling up the form not submitting it

查看:117
本文介绍了curl脚本只是填写表单不提交它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个小问题。
i已经写了一个curl脚本,首先点击链接
,然后填写链接提供的表单。



链接是parcel查询on http://www.fikeandfike.com/propertytax/Grundy/MainMenu .aspx?c = 32



,表单位于 http://www.fikeandfike.com/propertytax/Grundy/Inquiry.aspx



但我的问题是脚本只填满表单和
不做任何事情



当我回应curl的结果
它显示填写的表单,但是我想看到形式的结果



你能告诉我为什么会这样吗?
你能建议一些技巧来解决这个问题吗?

解决方案

您尝试刮的网站是使用ASP.net构建的,它不以常规方式使用表单数据。



我知道有人成功获得这工作,但它是fiddly。要注意的关键隐藏字段是:




  • __ EVENTTARGET __ EVENTARGUMENT :这些是在您提交表单时通过Javascript设置的,但始终为相同的值。如果您使用浏览器调试工具(Firebug,URLParams等)检查实际POST的结果,您将能够填补这些问题。

  • __ VIEWSTATE :这是在每次加载网页时重新生成的,因此您需要在每次请求时从加载表单的HTML中将其删除。

  • __ EVENTVALIDATION :此字段专门用于防止您尝试的欺骗。像 __ VIEWSTATE ,它会在每次加载网页时重新生成,但它的存在可能意味着您只能每次更改一个字段,因为它会验证


  • 我可能在这里的一些细节上错了,但这应该给你在某个地方开始...


    i have this small problem. i have written a curl script to first click a link and then fill up the form that the link provides.

    the link is "parcel enquiry" on http://www.fikeandfike.com/propertytax/Grundy/MainMenu.aspx?c=32

    and the form is on http://www.fikeandfike.com/propertytax/Grundy/Inquiry.aspx

    but my problem is the script is only filling up the form and not doing anything with it

    when i echo the result of curl it shows the form filled up but i want to see the result of form

    can you please tell me why is this happening? can you suggest some trick to get past this problem?

    解决方案

    As mentioned in the comments, the problem is that the site you are trying to "scrape" is built using ASP.net, which doesn't use form data in the conventional way.

    I do know someone who successfully get this working, but it is fiddly. The key hidden fields to watch out for are:

    • __EVENTTARGET and __EVENTARGUMENT: These are set by Javascript when you submit the form, but always to the same value. If you use a browser debug tool (Firebug, URLParams, etc) to inspect the result of a real POST, you will be able to fill these in no problem.
    • __VIEWSTATE: This is generated afresh every time the page loads, so you'll need to scrape it out of the HTML of the loaded form each time you request it.
    • __EVENTVALIDATION: This field exists specifically to prevent the kind of spoofing you are attempting. Like __VIEWSTATE, it is regenerated on each page load, but its presence may mean you can only change one field at a time, since it will validate what you submit against the previous state.

    I may be wrong on some of the specifics here, but that should give you somewhere to start...

    这篇关于curl脚本只是填写表单不提交它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆