I'm working on a page that gets html div code to my website page and displays on the website. My code goes like this:
require './simpledom.php';
$url = 'https://cit2.net/index.php?topic=75443.0';
$html = file_get_html($url); if (!empty($html)) {
$element = $html->find('div[id=msg_783326]');
if (!empty($element)) {
echo $element;
}
}
It won't show a thing where as the link contains things in it. I want it to show the specific div in that page in my website page. What should I do/edit in my code so it shows the specific div into my page.
EDIT: My HTML code under which I want to echo the div.
<div id="main_b">
<div class="wrapper">
<div id="main_content">
<?php
require './simpledom.php';
$url = 'https://cit2.net/index.php?topic=75443.0';
$html = file_get_html($url);
if (!empty($html)) {
$element = $html->find('div[id=msg_783326]');
if (!empty($element)) {
echo $element;
}
}
</div>
</div>
</div>
Before your edit I didn't realize that you were trying to
echo
$element
into the correct place already. But it seems like in your case you simply forgot the closing?>
php tag.EDIT: Still not outputting anything? Let's start the debugging process:
UPDATE: Try to login programatically