-1

I want to extract data from a website but I'm getting a warning.

    <?php
        include("simple_html_dom.php");
        $html = file_get_html("https://ffs-gaming.com/clans.php?clanid=1264");
        $title = $html->find("div.number", 0)->innertext;
        echo $title;
    ?>

With other websites it works very well but it doesn't with this one. I'm getting that warning.

Warning: file_get_contents(https://ffs-gaming.com/clans.php?clanid=1264): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in C:\xampp\htdocs\simple_html_dom.php on line 75

Fatal error: Call to a member function find() on boolean in C:\xampp\htdocs\index.php on line 12

Thanks in advance!

Community
  • 1
  • 1
Asez
  • 159
  • 1
  • 3
  • 13
  • Really don't see the point in _Community Bot_ bumping these ancient questions. Voting to close as _"Needs more focus"_. The API obviously needs credentials – Phil Mar 13 '22 at 22:43

1 Answers1

-1

They probably only allow real browser requests.

Try to emulate a browser using cUrl:

php curl: how can i emulate a get request exactly like a web browser?

Community
  • 1
  • 1
modsfabio
  • 1,097
  • 1
  • 13
  • 29