Page 1 of 1

[SOLVED] Page interaction

Posted: Wed Mar 30, 2005 1:58 am
by Morh
Hi there, I wonder if you people can help me with a small code I'm trying to make. I'm a newbie when it comes to PHP so don't expect too much of me. Well anyway here we go, I want to make a script that can "interact" with other pages that I don't have access to, for example: there is a postcount on a forum and I wan't to have that number shown on my page or that there is a list of names on a page and I wan't to have them shown on my page. How do I do it?

I'm kinda lost when it comes to thinking up stuff like this but couldn't it be done with fopen() and file_get_contents?

Posted: Wed Mar 30, 2005 10:10 am
by feyd
file_get_contents() will grab the entire page as a single string (if URL wrappers are on)

You can use regular expressions to find the part you want, or ghetto-style strpos() and explode() your way to it ;)

Posted: Wed Mar 30, 2005 10:22 am
by anjanesh
Just wanted to let you know what Im doing these data grabbing stuff now and its really taking time even on servers.
Using RegExp (preg_match) will take time. Dont use ereg - it takes even more time. file_get_contents() is really fast.
Reduce the number of subpatterns () - that again increases time.
If its one page you are parsing then it'll take a sec but if crawling through many it'll take tremedous amt of time.

Posted: Thu Mar 31, 2005 2:47 am
by Morh
Ok thanks guys, think I got it now.