I'm using simple-html-dom to try and pull some code from another site. Here's some simple example code that replicates what I'm trying to accomplish.
<html>
<body>
<h1>Title!</h1>
<div class="sample">
<div class="another_class">...</div>
<div class="one_more">
Some awesome text!
</div>
</div>
<div class="sample">
<div class="another_class">...</div>
<div class="one_more">
Some awesome text!
</div>
</div>
<div class="sample">
<div class="another_class">...</div>
<div class="one_more">
Some awesome text!
</div>
</div>
</body>
</html>
So I'm trying to pull all div sample blocks...including the tags. So basically I want to echo the following code onto my site, tags and all:
<div class="sample">
<div class="another_class">...</div>
<div class="one_more">
Some awesome text!
</div>
</div>
<div class="sample">
<div class="another_class">...</div>
<div class="one_more">
Some awesome text!
</div>
</div>
<div class="sample">
<div class="another_class">...</div>
<div class="one_more">
Some awesome text!
</div>
</div>
I just learned about simple-html-dom today, so I'm still trying to figure it out. Here's what I've gathered so far, which isn't working.
<?php
include('simplehtmldom_1_5/simple_html_dom.php');
$page = 'http://www.sampleURL.com';
$html = file_get_html($page);
foreach($html->find('div.sample') as $element)
echo $element->outertext . '<br />';
?>