[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ProgSoc] wget in php



> > $string = `wget -Coff -q -O /home/whophd/public_html/blah http://foo`;
>
> The magic question of the day is, "Why?"
>
>         $url = 'http://foo';
>         if ($fp = fopen($url, "r")) {
>                 while (!feof($fp)) {
>                         $string .= fread($fp, 8192);
>                 }
>                 fclose($string);
>         }
>
>         // Now, I guess you want to write it to a file?
>
>         if ($fp = fopen('~whophd/public_html/blah', 'w')) {
>                 fwrite($fp, $string);
>                 fclose($fp);
>         }
>
> What you're trying to do is a nasty, nasty hack. And to all the people
> saying "CHMOD 777 OMG LOL!", a pox on all your houses.

And how much would the former solution save the poor programmer in
terms of aches and strains on his/her poor fingers? And having to
consult the documentation?

btw it'd be much nicer to do those fwrites within the loop reading the
http response. Y'know - efficiency and all that (for all we know, CK
may be downloading raw uncompressed HD video data with this)

Well, it's a nice theory at least until some problem like this comes along :)

-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@xxxxxxxxxxxxxxxxxxx
If you are having trouble, ask owner-progsoc@xxxxxxxxxxxxxxxxxx for help.