waSaf Posted November 24, 2009 Share Posted November 24, 2009 i have a problem with my application here.. hope u guys can help me out of it... i have this page (www.data.com/page.asp) where this page dislay somesort of daily data. the data will change daily and to view previous data, we need to key in specific date and click on submit button. the form using $_POST data thus the URL of the page is remain the same regardless of the date selected and data displayed. i need to get few data in this website including the previous one. so i create a web-based apps (PHP) to display the html as string and strip the unneccessary string. this is the main structure of my apps.. ================== $code = file_get_contents("www.data.com/page.asp"); $html = htmlspecialchar($code); <--function strip unwanted string and return required data here--> ================== the apps can run successfully, but only for current day data. since i use direct URL (www.data.com/page.asp), the apps will only grab data shown on the page by default. i cant grab the data for previous date. so how to make my apps work as i intend? please help me. thanks in advance. Quote Link to comment Share on other sites More sharing options...
priti Posted November 24, 2009 Share Posted November 24, 2009 you can pass the date in querystring (www.data.com/page.asp?date=26-nov-2009) can necessary changes to throw output for the provided date !!. Quote Link to comment Share on other sites More sharing options...
waSaf Posted November 24, 2009 Author Share Posted November 24, 2009 you can pass the date in querystring (www.data.com/page.asp?date=26-nov-2009) can necessary changes to throw output for the provided date !!. the www.data.com/page.asp is not my own page.. it is an external page that i dont have control of it... so is there any way php can detect the $_POST data of the page? Quote Link to comment Share on other sites More sharing options...
waSaf Posted November 25, 2009 Author Share Posted November 25, 2009 rephrase my problem.... i intend to get few data on this specific page, eg. www.data123.com/page.php the method that i am using is, to parse the whole page into source code and use regex to filter what i want... the page have a form ($_POST) so that the visitor can select the data base on the date submitted. so, how to get the source code each time i submit new date? because im using file_get_contents here and the parameter used is only URL, while each time i submit new date, there is $_POST variable there... Quote Link to comment Share on other sites More sharing options...
trq Posted November 25, 2009 Share Posted November 25, 2009 curl. Quote Link to comment Share on other sites More sharing options...
cags Posted November 25, 2009 Share Posted November 25, 2009 Using cURL instead of file_get_contents you can send $_POST variables and capture the result. You can then scrape the result. Depending on what information your scraping you might be better off using some sort of DOMDocument rather than Regex, but thats another matter. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.