Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 955
ragulin Avatar asked Jan 25 '26 15:01

ragulin


1 Answers

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..!

like image 162
Keyur Vala Avatar answered Jan 27 '26 04:01

Keyur Vala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!