phphtmlparsingsourceforge

Simple HTML DOM parsing isnt functioning


I am trying to learn HTML DOM parsing at my localhost. But I crash right in the beggining.

  1. I have made a new project

  2. I have downloaded files from simplehtmldom.sourceforge.net

  1. I have put this code inside my HTML project

  2. I get this error, when I run the script:

Fatal error: Uncaught Error: Call to undefined function file_get_html() in C:\xampp\htdocs\PhpProject1\index.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\PhpProject1\index.php on line 15

Am I misunderstanding something here?


Solution

  • I think PHP DOM Parser Library No Longer Support to PHP latest Version so, You Need to Use cURL for that It will help you.

    <?php
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "http://www.google.co.in");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
    curl_close($curl);
    print $result;
    ?>
    

    Try this..!