Mac Os
Mac Os

Reputation: 97

how i can get parts of web pages by php

i want make a news site gets its content from other news sites, open the rss feed and feach url and open the html dom of the page then get just the text of the news i think i have to use the DOMDocument class of the php?

<?php
$doc = new DOMDocument();
$doc->loadHTML("<html><body>Test<br></body></html>");
echo $doc->saveHTML();
?>

http://www.php.net/manual/en/class.domdocument.php

Upvotes: 0

Views: 73

Answers (1)

Armin
Armin

Reputation: 15978

RSS feeds are XML. To get the links here I would use simpleXML. To load the page you can use cURL or HttpRequest.

To analyse the returned code I would use DOMDocument, too! Alternatively you could use simpleHtmlDom.

Upvotes: 1

Related Questions