Heres a script I wrote to pull the top viruses from antivirus.com
Hope this helps...
<?php
$antivirus=file ('http://www.antivirus.com/');
unset($start);
unset($stop);
$count=0;
foreach($antivirus as $line) {
if ( ! isset($stop) ) {
if ( eregi('Top viruses', $line) ) {
$start=$count;
}
}
if ( isset($start) && ! isset($stop) ) {
if ( $count > $start ) {
if ( eregi('</table>', $line) ) {
$stop=$count;
}
}
}
if ( ! isset($stop) ) {
$count++;
}
}
$count=$start;
while ($count <= $stop ) {
$data=str_replace('<', chr(10).'<', $antivirus[$count]);
$data=str_replace('>', '>'.chr(10), $data);
$data=explode(chr(10), $data);
foreach($data as $line) {
if ( !eregi('<.*>', $line) && trim($line) != '' && !eregi('<!--',
$line) && !eregi('\(.*\)', $line) ) {
?>
<tr>
<td bgcolor="#333333" align="center">
<?php
if ( $count != $start ) {
echo '<a
href="http://216.33.22.211/vinfo/virusencyclo/default5.asp?VName=';
echo eregi_replace("[0-9].......", '', trim($line));
echo '" target="_blank">'.chr(10);
} else {
echo '<font color="#FF0000">'.chr(10);
}
echo $line.chr(10);
if ( $count != $start ) {
echo '</a>'.chr(10);
} else {
echo '</font>'.chr(10);
}
echo '<br>'.chr(10);
?>
</td></tr>
<?php
}
}
$count++;
}
?>
-----Original Message-----
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 02, 2002 3:54 PM
To: Craig Westerman; php-general-list
Subject: Re: [PHP] fopen
Craig,
AFAIK you can't: fopen opens the file and leaves it up to you to read it
a character or some other chunk at a time, keeping what you want, and
leaving the rest. There is no concept of opening a file at a particular
character position, other than to write-over or write-append. (see
http://www.php.net/manual/en/function.fopen.php)
Regards,
=dn
> How can I use fopen to retrieve just one html table out of a whole web
page.
>
> I need to extract just this table (shown below) from this web page:
> http://quotes.nasdaq.com/quote.dll?page=multi&mode=stock&symbol=drooy
>
> Thanks Craig
> ***********************************************
>
> <table border="0" cellspacing="0" cellpadding="0" width="578">
> <tr>
> <td nowrap >
> <table border="0" cellspacing="0" cellpadding="0" >
> <tr>
> <td align="left" width="100" rowspan="2" class="logoFont">
> <img
>
src="http://a676.g.akamaitech.net/f/676/838/1h/nasdaq.com/logos/DROO.GIF
"
> border="0" align="absmiddle" height="40">
> </td>
> <td nowrap><font face="Arial, Helvetica, Verdana"
size="2"><b>Durban
> Roodeport Deep, Ltd.</b> DROOY</font></td>
> </tr>
> <tr>
> <td width="247" align="right"><font face="Arial, Helvetica,
Verdana"
> size="2">Mar. 1, 2002 Market Closed</font></td>
> </tr>
> </table>
> </td>
> </tr>
> <tr>
> <td nowrap>
> <table border="0" cellpadding="0" cellspacing="0">
> <tr>
> <td nowrap width="85">Last Sale:</td>
> <td align="right"
width="85"><nobr><b>$ 2.76</b></nobr></td>
> <td width="20"> </td>
> <td align="left" nowrap width="100">Net Change:</td>
> <td align="right"><nobr><b> <font
color=".FF0000">0.02</font><img
>
src="http://a676.g.akamaitech.net/7/676/838/b801fe1d2351e8/nasdaq.com/im
ages
> /nc_down.gif" border="0" width="11"
> height="10"></b></nobr> <nobr><b> <font
> color="FF0000">0.72%</font></b> </nobr></td>
> <td width="20"> </td>
> <td rowspan="5" valign="top" align="left" nowrap>
> <font face="Arial, Helvetica, Verdana" size="1">
> <a
>
href="http://www.nasdaq.com/asp/offsite_quotes.asp?symbol=DROOY%60&selec
ted=
> DROOY%60&content=http://www.drd.co.za"><img
>
src="http://a676.g.akamaitech.net/f/676/838/1d/nasdaq.com/images/new_web
link
> s.gif" border="0"></a> <a
>
href="http://www.nasdaq.com/asp/offsite_quotes.asp?symbol=DROOY%60&selec
ted=
> DROOY%60&content=http://www.drd.co.za" class="clsA">Web Site</a><br>
> </font>
> </td>
> </tr>
> <tr>
> <td nowrap width="85">Today's High:</td>
> <td align="right"><nobr><b>$ 2.80</b></nobr></td>
> <td width="20"> </td>
> <td nowrap width="100">Today's Low:</td>
> <td align="right" nowrap ><nobr><b>$ 2.64</b></nobr></td>
> </tr>
> <tr>
> <td nowrap width="85">Best Bid:</td>
> <td align="right"
width="85"><nobr><b>$ 2.75</b></nobr></td>
> <td width="20"> </td>
> <td nowrap width="100">Best Ask:</td>
> <td align="right" nowrap><nobr><b>$ 2.76</b></nobr></td>
> </tr>
> <tr>
> <td nowrap width="85">Volume:</td>
> <td align="right" width="85"><b>1,551,300</b></td>
> <td width="20"> </td>
> <td nowrap width="100">Previous Close:</td>
> <td align="right" nowrap><nobr><b>$ 2.78</b></nobr></td>
> </tr>
> <tr>
> <td nowrap valign="top" width="85">Market:</td>
> <td nowrap align="right" valign="top" width="85">Nasdaq-SCM</td>
> <td width="20"> </td>
> <td nowrap width="200" align="left" valign="top"
> colspan="2"><b>American Depositary Shares</b></td>
> </tr>
> </table>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php