Screen scapingin in php using file_get_contents

后端 未结 1 1804
夕颜
夕颜 2021-01-29 11:43

Hi I am very new to screen scraping. I am trying to scrape reviews from a hotel booking webite to display on to mine..

Ive got this far but got a bit stuck. Can anyone h

1条回答
  •  孤独总比滥情好
    2021-01-29 12:19

    use DomDocument

    loadHTML(file_get_contents(URL));
      $summary = $doc->getElementById('summary');
      // also have $doc->getElementsByTagName , etc
      var_export($summary);
    ?>
    

    Also, for more complicated queries you should consider looking into XPATH (uses jQuery-like syntax)

    0 讨论(0)
提交回复
热议问题