Re: Searching HTML file for <tr> tags
| From: | Mukul Sabharwal | Date: | Fri, 09 Feb 2001 02:21:17 +0000 |
| Subject: | Re: Searching HTML file for <tr> tags | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38872@lists.php.net to get a copy of this message | ||
Hi,
You've forgot to put fread() :
<?
$file = fopen('closings.html', 'r');
if (!$file) echo 'Error opening file';
else echo 'got the file<br>';
$data = fread($file, filesize('closings.html'));
if
(eregi('<tr><td>Stratford</td><td>Closed</td></tr>',
$data))
echo 'Stratford closed';
else
echo 'Stratfor open';
?>
--- Tyler Longren <tyler.longren@midiowa.net> wrote: >
Hello everybody,
>
> Here's my code:
>
> <?
> $file = fopen("closings.html", "r");
>
> if (!$file) {
> print "Error getting file";
> }
> else {
> print "Closings.html has been gotten<Br>";
> if
>
(eregi("<tr><td>Stratford</td><td>Closed</td></tr>",$file))
> {
> print "Stratford Closed";
> }
> else {
> print "Stratford Open";
> }
> }
> ?>
>
> The file closings.html has tables with weather
> related closings. I want to
> search closings.html for this line:
> <tr><td>Stratford</td><td>Closed</td></tr>
>
> If that line is found, it prints "Stratford Closed",
> if it finds that line,
> it prints "Stratford Open". I'm not sure that the
> file is even open all the
> way. Thanks everyone!
>
> Regards,
> Tyler
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
php-list-admin@lists.php.net
=====
To find out more about me : http://www.geocities.com/mimodit
My bookmarks are available @ http://mukul.free.fr
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/