Search code examples
phpsimple-html-dom

simple html dom load_file returns array


I have a weird problem. I've been using Simple Html Dom library for a while now, but trying to load a certain page always returns content in an array, and not HTML. I'm stumped.

This is the code:

$target_url = "https://www.bol.com/nl/p/foscam-fi9928p-1080p-ptz-dome/9200000075190022/prijsoverzicht/";
    $html->load_file($target_url);
    echo "$html";

I've also tried file_get_contents and file_get_html, as wel as tried with a cURL library; they all return an array. Also it only appears to happen on these overview pages, not on product pages themselves.


Solution

  • The reason is probably that bol.com returns JSON.

      Content-Type: application/json;charset=UTF-8