Lewis Hardisty
Lewis Hardisty

Reputation: 121

PHP Simple HTML DOM Parser not Returning Anything

I'm trying to use the PHP Simple HTML DOM Parser for the first time from here - https://simplehtmldom.sourceforge.io/docs/1.9/index.html

Unfortunately, I'm having an issue where it's not returning anything no matter what I try.

Any help would be much appreciated. My code is below:

<?php
    require_once($_SERVER['DOCUMENT_ROOT'] . '/assets/html_dom_parser/simple_html_dom.php');
    $amazonASIN = "B0C89F1V5S";
    $html = file_get_html("http://www.amazon.co.uk/dp/".$amazonASIN);
    if($html) {
        $price = $html->find('.a-price-whole', 0);
        print_r($price);
        echo 'price is '.$price;
    }
?>

I'm essentially trying to get the price from - https://www.amazon.co.uk/dp/B0C89F1V5S

Thanks!

Upvotes: 0

Views: 21

Answers (0)

Related Questions