Unable to get all the span values Unable to get all the span values curl curl

Unable to get all the span values


 <?php $ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'http://www.amazon.in/gp/product/B00UMSAWOY/');curl_setopt($ch, CURLOPT_HEADER, false);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);$html = curl_exec($ch);curl_close($ch);     $dom = new DOMDocument; @$dom->loadHTML($html); $xpath = new DOMXPath($dom);$searchNode = $dom->getElementsByTagName( "span" );  foreach ($dom->getElementsByTagName('span') as $tag)                  {//echo $tag->getAttribute('id');if($tag->getAttribute('id')=='productTitle'){    echo $tag1=$tag->nodeValue . '<br/>';}if($tag->getAttribute('id')=='priceblock_saleprice'){    echo $tag1=$tag->nodeValue . '<br/>';}}?>

i have found out the solution friends. thanks for helping


Below code will solve your problem

preg_match_all('/<span>.*?<\/span>/is', $result, $matches);