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
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&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.