On Fri, 2002-02-01 at 13:28, Robby wrote:
> I am using this code below but it does not work (php in installed and
> working proplely):
You should provide a bit more information than "it's not working".
It helps immensely to know exactly *how* it isn't working. That
said, here's what sprang immediately to mind from the code below:
> <?php
>
> $file=fopen("http://somedomain/time.html", "r");
> if (!$file)
>
> echo "error when connect\n";
> exit;
> }
> $line = fread ($file, filesize ($file));
^^^^^^^^^^^^^^^^
Two things: 1) filesize() takes a filename, not a file descriptor
resource, as an argument; and 2) filename() doesn't work on remote
files. Check the manual page for more information:
http://www.php.net/manual/en/function.filesize.php
> eregi("^{<font color=green><b>}{.*}{</b></font>}$", $line, $out)
First, you need a semicolon at the end of the line--but I think that's
just a typo. ;)
Second: unless you're actually searching for curly braces, remove them.
They are special characters in regexes and if you're going to include
them, they'll need to be escaped.
Third: I gather that you're trying to get the content of the bold tag
here--if so, you'll need to encompass the '.*' with parentheses, so that
its value is copied into $out.
Ultimately, your line should look something like the one below:
if (eregi("^<font color=green><b>(.*)</b></font>$", $line, $out)) {
print_r($out);
} else {
echo "Failed\n";
}
Hope this helps,
Torben
> echo "$out[1]";
> fclose($file);
> ?>
>
>
> Robby
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]