Yeah, filesize() does not work with urls. Suggested file() and implode()
earlier for this task and didn't mention fgets() as it may be appropriate
here as well.
http://www.php.net/fgets
http://www.php.net/file
Both manual entries have examples that do exactly what you want, "Put a
url contents into a string." fgets() is nice because you don't have to
gets the entire file, sticking a break; in there during a "match" can be
uber cool :-)
If this is being done locally then of course don't go through http:// ...
Regards,
Philip Olson
On Sun, 23 Sep 2001, Simon Roberts wrote:
> Check the value of filesize($fileName). It's probably not working - either
> because PHP doesn't support it with URLs (likely) or that it's can't get the
> length from the webserver (less likely).
>
> PS: don't cross-post this sort of message to php-dev. That's for people
> developing PHP, not developing *in* PHP.
>
> ----- Original Message -----
> From: "CC Zona" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Saturday, September 22, 2001 4:32 PM
> Subject: [PHP-DEV] Re: fopen, fread
>
>
> > In article <[EMAIL PROTECTED]>,
> > [EMAIL PROTECTED] (Dries Plessers) wrote:
> >
> > > Can anybody tell me what is wrong. $file contains nothing ?????
> >
> > > $fileName="http://www.proxis.com";
> > > $fp=fopen($fileName, "r");
> > > $file=fread($fp, filesize($fileName));
> > > fclose($fp);
> > > print("$file");
> >
> > Not a good idea to just assume that every fopen will be successful (and
> > therefore go ahead with the read) or that every fread will be successful
> > (and therefore go ahead with the print). Throw some error checking in
> > there, and PHP will likely tell you where the code is failing and why.
> >
> > --
> > CC
> >
> > --
> > PHP Development 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]
> >
>
>
> --
> 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]
>
--
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]