Page 1 of 1
Communicate with a webpage to generate data simultaneously
Posted: Wed Oct 19, 2011 11:54 am
by shantothegreat
I want a script that lives in my server and communicate with a webpage to generate some data from the page. This script'll simultaneously collect data from the page in every 5 seconds. I am a newbie in php. So anyone can give me some code or suggestion or some link plz?? I'll do the data separating task from the html and store the data in database myself. I just want to get the page simultaneously in every 5 sec.
Re: Communicate with a webpage to generate data simultaneous
Posted: Wed Oct 19, 2011 6:08 pm
by twinedev
You will need javascript on the page to preform AJAX calls back to the server to pass it data from the page (ie, form fields, where they are scrolled to on the page, etc)
It will depend how your page is designed, if you use a framework, which one, as to the actual code, but whichever you use, it will be some type of AJAX call.
-Greg
Re: Communicate with a webpage to generate data simultaneous
Posted: Thu Oct 20, 2011 2:06 pm
by shantothegreat
I search in the net since my last post and I found that the things I want is called php screen scrap. My script'll collect data from another webpage that is not mine and store the data in a database. But I want to run the script in every 5 seconds to collect the data.
Re: Communicate with a webpage to generate data simultaneous
Posted: Thu Oct 20, 2011 10:16 pm
by twinedev
Ahh, well you can have a script that runs infinitely, and does a sleep(5) between loops.
Now a key thing will be the site you are scraping. If it was mine, and I saw that load, I would block you IP, so to prevent problems, should check with the site owner if it is not another site of yours. Additionally, if you plan on constantly do it every 5 seconds, pretty much forever, your provider and/or their provider may consider it an attack and block you as well.
-Greg
Re: Communicate with a webpage to generate data simultaneous
Posted: Fri Oct 21, 2011 4:53 am
by shantothegreat
Thanks for the reply.