Reading certain parts of a webpage with file_get_contents()

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
greenking
Forum Newbie
Posts: 1
Joined: Thu Aug 03, 2006 11:15 pm

Reading certain parts of a webpage with file_get_contents()

Post by greenking »

Hello, I am trying to create a php script that will open a URL and then take certain things off of that webpage. I dont want the whole page, just some of the information on it.

I'm using, and it is working:

$handle = file_get_contents("url");
echo $handle;

But I do not know where to go from here, how do I get the pieces of information I need?

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

Post by feyd »

substr() and preg_match(), among others, can be used to pull out pieces from the resulting string.

I hope you have permission to pull information. If the site offers an RSS feed, maybe the information you seek is in there.
Post Reply