phphtml-parsingsimpledom

php simple html dom parser doesn't return anything


Why won't my script return the div with the id of "pp-featured"?

<?php
# create and load the HTML  
include('lib/simple_html_dom.php');  
$html = new simple_html_dom();  
$html->load("http://maps.google.com/maps/place?cid=6703996311168776503&q=hills+garage&hl=en&view=feature&mcsrc=google_reviews&num=20&start=0&ved=0CFUQtQU&sa=X&ei=sCq_Tr3mJZToygTOmuCGCg");  

$ret = $html->find('div[id=pp-featured]');

# output it!  
echo $ret->save();
?>

Solution

  • this gets me on my way. Thanks for your help.

    <?php
    
    include_once 'lib/simple_html_dom.php';
    
    $url = "http://maps.google.com/maps/place?cid=6703996311168776503&q=hills+garage&hl=en&view=feature&mcsrc=google_reviews&num=20&start=0&ved=0CFUQtQU&sa=X&ei=sCq_Tr3mJZToygTOmuCGCg";
    
    $html = file_get_html($url);
    
    $ret =  $html->find('div[id=pp-reviews]');
    
    foreach($ret as $story)
        echo $story;
    
    ?>