Jump to content

Recommended Posts

I want to extract current data from a particular website(http://www.ncdex.com/MarketData/LiveFuturesQuotes.aspx) and then show it on my website.

 

I want to extract only if the Data is "Chana" or else move to next line or stop. Because the website keeps on updating and the field(Chana) always changes its rows.

Please help me.

<html>
   
    <body>
   


<?php
$html = file_get_contents('http://www.ncdex.com/MarketData/LiveFuturesQuotes.aspx'); //get the html returned from the following url


libxml_use_internal_errors( true);
$doc = new DOMDocument;
$doc->loadHTML( $html);
$xpath = new DOMXpath( $doc);


$node4a = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[1]/a')->item( 0);

$node4b = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[7]')->item( 0);

$node4c = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[8]')->item( 0);

$src4 = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[7]/img/@src')->item( 0);

$node4d = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[2]')->item( 0);


echo $node4a->textContent; // This will print **Chana**
echo $node4b->textContent;
echo $node4c->textContent;
echo $img1; echo $src4->nodeValue; echo $img2;
echo "|";
echo $node4d->textContent; echo "<br>";


?>

</html>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.