lolalola
lolalola

Reputation: 3823

Parse text from an HTML page

I know it is possible to get information (text) from another page.

For example, on the page at http://www.page.com/ is a div named news. How can I get the text from this div?

Upvotes: 0

Views: 1034

Answers (2)

Sarfraz
Sarfraz

Reputation: 382881

Yes, that's what HTML Simple DOM is for amongst other options.

Example:

$html  = file_get_html('http://www.page.com/');
$mydiv = $html->find('div[id=news]', 0)->plaintext;

Upvotes: 4

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799450

Use an HTML parser.

Upvotes: 0

Related Questions