douzepao0281 2012-08-19 14:49
浏览 121
已采纳

无法访问链接

I have a small problem. I am trying to submit a form to http://www.fikeandfike.com/propertytax/Grundy/Inquiry.aspx

but it cannot be directly navigate even in browser(i really don't have a clue why?) to go to above link it is mandatory to click "Parcel enquiry" on http://www.fikeandfike.com/propertytax/Grundy/MainMenu.aspx?c=32

so i want to click and follow the "parcel enquiry" link using a php script. if i directly access the former link using cURL i get "Object reference not set to an instance of an object." error

please guide me on how to click and follow the link

  • 写回答

1条回答 默认 最新

  • dsiy62758 2012-08-19 14:57
    关注

    To get the same result using PHP you will need to have the Javascript function that is called on clicking 'Parcel Inquiry' in your PHP script, to mimic the result:

    HTML for the link in your PHP script:

    <a id="ctl00_Main_lnkParcelInquiry" style="color:Blue;" href="javascript:__doPostBack('ctl00$Main$lnkParcelInquiry','')">Parcel Inquiry</a>
    

    JS to define the __doPostBack function and form in your PHP script:

        <script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['aspnetForm'];
    if (!theForm) {
    theForm = document.aspnetForm;
    }
    function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
    }
    }
    //]]>
    </script>
    <script src="/PropertyTax/Grundy/WebResource.axd?d=k82Y5NDDJDDbxvQs15CYbKKGrXzg8maOqY0bqltbogQI3NDmBuf75gWfcLjILBbAmbWOYgfVPqLiO6Kf2KileNBCke01&amp;t=634622168376055000" type="text/javascript"></script>
    

    And so you will also need that form, <form name="aspnetForm" action="http://www.fikeandfike.com/propertytax/Grundy/Inquiry.aspx">, to exist in your script.

    It's just a matter of doing it the same way; so copy the code and the functions and you should get the same results.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源