Communicate with a webpage to generate data simultaneously

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shantothegreat
Forum Newbie
Posts: 4
Joined: Wed Oct 19, 2011 10:53 am

Communicate with a webpage to generate data simultaneously

Post 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.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Communicate with a webpage to generate data simultaneous

Post 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
shantothegreat
Forum Newbie
Posts: 4
Joined: Wed Oct 19, 2011 10:53 am

Re: Communicate with a webpage to generate data simultaneous

Post 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.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Communicate with a webpage to generate data simultaneous

Post 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
shantothegreat
Forum Newbie
Posts: 4
Joined: Wed Oct 19, 2011 10:53 am

Re: Communicate with a webpage to generate data simultaneous

Post by shantothegreat »

Thanks for the reply.
Post Reply