|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with data extraction using snoopy class
Hello Experts,
We are trying to extract data from a webpage, this involves submitting a form and extracting the data from resultant webpage.For this task we are using 'snoopy' class. Problem is once we run the following program, snoopy is displaying the contents of the same form page instead of retrieving the resultant submitted page. Are we missing anything in the following snoopy implementation? ++++++++++++++++++++++++++++++++++++++++ include "Snoopy.class.php"; $snoopy = new Snoopy; $submit_url = "http://clientdb.trueautomation.com/clientdb/main.asp?id=9"; $submit_vars["OwnerName"] = "SMITH LEE"; $submit_vars["submit"] = "Search Records"; if($snoopy->submit($submit_url,$submit_vars)) { while(list($key,$val) = each($snoopy->headers)) echo $key.": ".$val."<br>n"; echo "<p>n"; echo "Displaying Results<br>"; echo "<PRE>".htmlspecialchars($snoopy->results)."</PRE>n"; } else echo "error fetching document: ".$snoopy->error."n"; ?> ++++++++++++++++++++++++++++++++++++++++ Please help me out. Thanks in advance. Regards Swiftguy. |
|
#2
|
|||
|
|||
|
RE: Problem with data extraction using snoopy class
When you submit to a form, you submit to the URL in the action="..." parameter. The URL you posted above is the form that is sent to the browser.
The action parameter in the form on that page is: action="searchresults.asp?ID=9" So, I believe the url you should be using is: $submit_url = "http://clientdb.trueautomation.com/clientdb/searchresults.asp?ID=9"; The reason you are getting the form back when you submit to the existing URL is that it is not expecting the POST variables your code is sending and basically ignores them, so this is the same as just browsing to the existing URL, which is the form that is sent to the browser... |
|
#3
|
|||
|
|||
|
RE: Problem with data extraction using snoopy class
Thanks your adviced helped !
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Applications > Problem with data extraction using snoopy class |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|