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 : - <?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>";}
-
?>
-
can anybody make me understand of this code.
5 1984
in short, they read a website and extract data from a HTML table.
Thanks for reply but they read data from all HTML Tables or any specific table from that HTML Source.
any table that starts like defined in line #45
You mean table which is defined only on line #45. no other tables have been read ?
basically, yes. That’s what the code says.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jole |
last post by:
Hi
I'm using serialization to read in an object from a file. My code basically
does this:
1)MyClass obj = (MyClass) in.readObject();
('in' is an ObjectInputStream wrapped around a...
|
by: Me |
last post by:
I am not understanding an aspect of how to implement a class template in a
..cpp file.
What I do know is that there are at least two problems with my understanding
of how to accomplish the...
|
by: Torbjørn Pettersen |
last post by:
I'm having problems validating my HTML code because of some
ASP code I'm using:
---Start Code---
<%
If rs("Average") = 0 Then
VotingImage = "<img src="/images/0.gif" alt='No votes yet'>"...
|
by: Bangalore |
last post by:
Hi all,
I am finding quite difficulty in understanding the behaviour of the
following
program.
Base class is singleton, so it should allow the creation of only one
object.
Eventhough it is...
|
by: Phil McKraken |
last post by:
I am having a problem putting together a shopping cart with the below
script. Everything displays fine, adds totals fine, and works perfect
EXCEPT if you choose the 9.95 item #5 BY ITSELF the total...
|
by: Patrik Huber |
last post by:
Hello!
I got the following Code in Assembler (NASM), which prints out "5" in
realmode:
mov ax, 0xB800
mov es, ax
mov byte , '5'
I want to do the same in gcc now, but I'm stuck. GCC...
|
by: Xarky |
last post by:
Hi,
I am writing a linked list in the following way.
struct list
{
struct list *next;
char *mybuff;
};
|
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem...
|
by: rn5a |
last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB
table. Users can modify the records using this DataGrid for which I am
using EditCommandColumn in the DataGrid. This is the...
|
by: eBob.com |
last post by:
I have this nasty problem with Shared methods and what I think of as "global
storage" - i.e. storage declared outside of any subroutines or functions.
In the simple example below this "global"...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |