extract some text from html

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
Nuzhser
Forum Newbie
Posts: 2
Joined: Mon Jun 07, 2010 10:16 am

extract some text from html

Post by Nuzhser »

I get source of some files. Then i need to extract fragments of text from there. What functions do you recommend to use?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: extract some text from html

Post by Jonah Bron »

You have two options. You can use regex, or you can use the XML DOM. Using one over the other depends on how predictable the target page is (and whether or not the page is valid HTML). Do you have an example to give us?
Post Reply