Looking for Function

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
AngeloDS
Forum Newbie
Posts: 6
Joined: Wed Apr 06, 2005 9:20 am

Looking for Function

Post by AngeloDS »

I'm looking for a PHP function where it takes the HTML from another site and redisplays it?

I'm using it for a stats type thing, to call from another site looking for a specific starting string and a specific ending string and copy all the HTML from there to my site heh.

Thanks
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

AngeloDS
Forum Newbie
Posts: 6
Joined: Wed Apr 06, 2005 9:20 am

Post by AngeloDS »

I want it to search for a string, such as

Code: Select all

<b>Member List</b>
And find an end string such as

Code: Select all

</td>
Then display the HTML between the two areas.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Regular expressions
preg_...()

Code: Select all

preg_match_all('/<b>Memeber List<\/>((.|\s)*?)<\/td>/', $string, $matches);
echo $matches[0];
AngeloDS
Forum Newbie
Posts: 6
Joined: Wed Apr 06, 2005 9:20 am

Post by AngeloDS »

Thanks there (y)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

psssst, missing a 'b' :)
AngeloDS
Forum Newbie
Posts: 6
Joined: Wed Apr 06, 2005 9:20 am

Post by AngeloDS »

Picky, so... Here's how I'm going to have it set.

Log me into the site using my name and pass, then copy and paste the online information at intervals of 1 minute, and display the information on my site -_-. Too bad I suck, and this will take forever haha... :( *cries*
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

to log in, you may want to look at curl. It can more easily send post data, after that, you can have it retrieve the page(s). Note: you must save the cookies the site hands out, and send them back for logging in to work (typically).

I hope you have permission from that site to display data from their pages on yours.
AngeloDS
Forum Newbie
Posts: 6
Joined: Wed Apr 06, 2005 9:20 am

Post by AngeloDS »

Aha, thanks. I'm trying to learn on my own but it's a bit hard :\. I'm more into editing PHP than making it from scratch. Any good sites with good example code?
Post Reply