views:

56

answers:

2

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?

A: 

Use an HTML parser.

Ignacio Vazquez-Abrams
+3  A: 

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;
Sarfraz
+1 for using HTML simple dom parser which is similar to jQuery in terms of selectors :) however please don't forget to use `clear()` method when using multiple instances of HTML DOM (i.e. in iteration) as it's easy to reach the memory limit using this library :)
migajek
@migajek: thanks and sure this is just an example, OP is supposed to visit their site for more info about it.
Sarfraz
@Sarfraz, I'm afraid that they do not state anywhere that is recommended to use "clear", that's why I've written it here ;)
migajek