I am trying to get the contents of a div from the id name.
Here is the div I am trying to get: <div id="article-body"> ... </div>
However, this is on another external website so it has to be called with a www or an http:// etc...
I am sure it's possible. Just not sure if I should use PHP, DOM or jQuery etc..
I am thinking this code should be possible to do in a few lines. Just don't know what is the best method. Thanks for the tips or ideas.
UPDATE: It was suggested this was a duplicate question. It is not. I have used the code from the suggested duplicate question below and it does not work.
Here is one of the errors: Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: ID changeRegionForm already defined in Entity, line: 85 in /home/content/w/i/s/wisdom33/html/testing/getDivExternalWebsite.php on line 14
Here is a link to the code: http://massmediamail.com/testing/getDivExternalWebsite.php
Here is the code:
<html>
<body>
<?
$doc = new DomDocument;
// We need to validate our document before refering to the id
$doc->validateOnParse = true;
$doc->loadHtml(file_get_contents('http://www.lifesitenews.com/news/second-madagascar-archbishop-criticizes-catholic-relief-services-full-trans'));
var_dump($doc->getElementById('article-body'));
?>
</body>
</html>