get data by using dom with their classes
<p>I want to get the data of STOCK MARKET TODAY Changes from the link <a href="http://www.nasdaq.com/" rel="nofollow">http://www.nasdaq.com/</a> exactly this part cropped in image <a href="http://postimg.org/image/husupx7m9/" rel="nofollow">http://postimg.org/image/husupx7m9/</a></p>

<p>i tried the below code</p>

<pre><code>$dom = new DOMDocument();
$dom-&gt;loadHTML($html);
$xpath = new DOMXPath($dom);

$classname = "marginB5px";

$tags = $xpath-&gt;query("//*[contains(concat(' ', normalize-space(@class), ' '), '    $classname ')]");
foreach ($tags as $tag) {
var_dump($tag-&gt;nodeValue);
echo "&lt;br /&gt;";
}
</code></pre>

<p>but this code shows the data like the below mentioned</p>

<hr>

<pre><code>nasdaqHomeIndexChart.storeIndexInfo("NASDAQ","3465.66","3.05","0.09","1,038,235,132","3475.48","3455.15");

nasdaqHomeIndexChart.storeIndexInfo("DJIA","15261.27","46.02","0.30","","15301.34","15175.39");

nasdaqHomeIndexChart.storeIndexInfo("S&amp;P 500","1657.11","6.77","0.41","","1661.49","1646.68");

nasdaqHomeIndexChart.storeIndexInfo("NASDAQ-100","2993.83","-2.22","0.07","","3004.52","2989.61");

nasdaqHomeIndexChart.storeIndexInfo("NASDAQ-100 PMI","2991.32","-4.73","0.'... (length=1125)
</code></pre>

<p>is there any way i can get the data with its class names so i store data by using preg_match in an array...</p>

<p>actually exactly what i want to achieve is the data like this..</p>

<p>in multi dimentional array may b</p>

<hr>

<blockquote>
  <p>MyArray => Array(NASDAQ){ [Value1] => "23",  [Value2] => "2523" }</p>
  
  <p>MyArray => Array(DJIA){ [Value1] => "23",  [Value2] => "2523" }</p>
</blockquote>
