$url = "http://www.amazon.in/gp/product/B00UMSAWOY/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
curl_exec($ch);
curl_close($ch);
preg_match_all("/<span>(.*)<\/span>/", $result, $matches);
print_r($matches);
foreach($matches[1] as $val)
{
echo $val."<br>";
}
If I run this query I am getting the result as 996-2015, Amazon.com, Inc. or its affiliates
. But I need all the span values that are available in the link. The thing I want to print is product name and its price. Can anyone help solving this problem?