I am vaibhav here i am a .net developer. I need help if anybody can I am having one php code that I need to convert in asp.net. but I do not understand what actually they had done in php so if anybody can explain that what have they done then I can convert it.
Php code is as follows :
can anybody make me understand of this code.
Php code is as follows :
Code:
<?php
$tt = "Corn Futures (CZ)";
echo "<SPAN class='tt'>".$tt."</SPAN>";
$rowspr = 0;
$outmode = 0;
$dataavl = 0;
$hand = fopen("http://www.cbot.com/cbot/pub/page/0,3181,793,00.html",r);
while (!feof($hand)) {
$buffer = fgetss($hand, 4096,"<table><th><tr><td><br><ul><li>");
if(strpos($buffer, "<table width='650' border='0' cellpadding='3' cellspacing='0' class='tableright'>")!==false){$outmode = 1;$dataavl = 1;}
if(strpos($buffer, "<tr class='dataDetails")!==false){$rowspr = $rowspr + 1;}
if($rowspr == 4){$outmode = 0;echo "</table>"; $rowspr = $rowspr + 1;}
if($outmode == 1)
{
$buffer = str_replace("= Chart","",$buffer);
$buffer = str_replace("= Option","",$buffer);
echo $buffer;
if(strpos($buffer, "</table>")!==false){$outmode = 0;}
}
}
fclose($hand);
if($dataavl == 0){echo "<br><i>Data is currently not available.</i>";}
?>
<br>
<br>
<br>
<?php
$tt = "Ethanol Futures (EZ)";
echo "<SPAN class='tt'>".$tt."</SPAN>";
$rowspr = 0;
$outmode = 0;
$dataavl = 0;
$hand = fopen("http://www.cbot.com/cbot/pub/page/0,3181,1754,00.html",r);
while (!feof($hand)) {
$buffer = fgetss($hand, 4096,"<table><th><tr><td><br><ul><li>");
if(strpos($buffer, "<table width='650' border='0' cellpadding='3' cellspacing='0' class='tableright'>")!==false){$outmode = 1;$dataavl = 1;}
if(strpos($buffer, "<tr class='dataDetails")!==false){$rowspr = $rowspr + 1;}
if($rowspr == 4){$outmode = 0;echo "</table>"; $rowspr = $rowspr + 1;}
if($outmode == 1)
{
$buffer = str_replace("= Chart","",$buffer);
$buffer = str_replace("= Option","",$buffer);
echo $buffer;
if(strpos($buffer, "</table>")!==false){$outmode = 0;}
}
}
fclose($hand);
if($dataavl == 0){echo "<br><i>Data is currently not available.</i>";}
?>
Comment