0

I am an inexperienced programmer with DOM. I need to find out a div to remove it and all the content inside it. I have written the following code to get the div with class "name page_footer_container" . When I m trying to output the finding to test if all is fine, I get following error.

__________________Code_________________________________________

         require_once('simple_html_dom.php');
          $html = file_get_html($url);

           $element=$html->find('div[class=page_footer_container]');
            echo $element->outertext;

I get the following message with no result : Notice: Trying to get property of non-object.

Would you please let me know what is the problem and what is the best strategy to remove a div with all of its content.

This section of the page I want to remove :

 <div class="page_footer_container" >
       <div class="page_footer_content">
         <div class="page_footer_liner" ><hr class="page_footer_divider_above">
           <div       class="page_footer_text" ><a href="url">Click here to read our privacy policy.
                   <br>
                        Copyright © 2009-2012 mysite INc</a></div></div>        
           </div><div class="powered_by" >
                       <p><a rel="nofollow" href="#" target="_blank">
                             <img src="" border="0" alt=""></a><br><a rel="nofollow" href="" target="_blank"><strong>KKK</strong></a></p>
    </div></div>

Thanks a lot

wblteam
  • 53
  • 2
  • 10
  • I prefer using jQuery for this kind of stuff. – Daan Jan 08 '15 at 10:16
  • Your `$html` is false, I think: `Trying to get property of non-object.`. http://stackoverflow.com/questions/54566/call-to-a-member-function-on-a-non-object – vaso123 Jan 08 '15 at 10:28

1 Answers1

0

Try to get the div this way:

$element=$html->find('div.page_footer_container');

With simple_html_dom you can search for elements using . for class and # for id.

Luis Simioni
  • 126
  • 6