I try this code But It's Return NULL object!
<?php
ini_set('max_execution_time', 300);
include_once ('Scraper.php');
$scraper = new Scraper();
$pageUrl = 'https://www.zara.com/tr/en/wrap-blouse-with-bow-p04437059.html?v1=6022035&v2=943001';
$pageHtmlContent = $scraper->curl($pageUrl);
$dom=new DOMDocument();
$dom->load($pageHtmlContent);
$xpath=new DOMXPath($dom);
$prise= $xpath->evaluate('(//div[@class=\'._product-price\'])');
var_dump($prise);
?>
I use selectorGadget to Make XPATH Address .
Sorry, can't add comment, not enaugh reputation :(.
You'r xpath is incorect, I can't find anything in given url. Please provide what you wish to find.
Edit to comment
To find exact div (as I tried, there is only 1 div with certains class in given url), use this xpath (//*[contains(@class,'_product-price')])
. If you need the price that is within that div, use this xpath (//*[contains(@class,'_product-price')]/span)
. If there will be more then 1 xpath, use this (//*[contains(@class,'_product-price')]/span)[i]
where i
is within loop over DOM elements.
e.g.
dom_elements = [get_dom_elements]
store_value = []
i = 1
while i < len(dom_elements):
xpath = '(//*[contains(@class,'_product-price')]/span)[i]'
store_value.append(some_function_for_getting_value_of_dom(xpath))
i += 1