[PHP] php wget: Return an empty file

2005-04-08 Thread Chris Blake
Greetings PHP(eople),

I have a wget process that runs to download a file from a web site,
however, if no file exists at the location I`m pulsing, how do I get it
to abort ?

Here is the code :

?php
$getfile = 'wget -dv -o log.txt http://www.somesite.co.za/somefile.php';
$get = shell_exec($getfile);
?

I looked at filesize(), but if no file is brought back then there is
nothing for the function to check.

If someone could point me to the right PHP function, or a link
somewhere...

Regards

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 782 0840
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

I have a very good DENTAL PLAN. Thank you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php wget: Return an empty file [Solved]

2005-04-08 Thread Chris Blake
On Fri, 2005-04-08 at 09:47, Chris Blake wrote:
 Greetings PHP(eople),
 
 I have a wget process that runs to download a file from a web site,
 however, if no file exists at the location I`m pulsing, how do I get it
 to abort ?
 
 Here is the code :
 
 ?php
 $getfile = 'wget -dv -o log.txt http://www.somesite.co.za/somefile.php';
 $get = shell_exec($getfile);
 ?
 
 I looked at filesize(), but if no file is brought back then there is
 nothing for the function to check.
 
 If someone could point me to the right PHP function, or a link
 somewhere...

No worries, file_exists() was what I was looking for.

Regards

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 782 0840
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

When managers hold endless meetings, the programmers write games. When
accountants talk of quarterly profits, the development budget is about
to be cut. When senior scientists talk blue sky, the clouds are about to
roll in. Truly, this is not the Tao of Programming. When managers make
commitments, game programs are ignored. When accountants make long-range
plans, harmony and order are about to be restored. When senior
scientists address the problems at hand, the problems will soon be
solved. Truly, this is the Tao of Programming. -- Geoffrey James, The
Tao of Programming

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php wget: Return an empty file

2005-04-08 Thread Josip Dzolonga
Chris Blake wrote:
Greetings PHP(eople),
I have a wget process that runs to download a file from a web site,
Why would you do that ? There're bultin functions in PHP for doing it.
--
Josip Dzolonga
http://josip.dotgeek.org
jdzolonga[at]gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php wget: Return an empty file

2005-04-08 Thread Chris Blake
On Fri, 2005-04-08 at 13:52, Josip Dzolonga wrote:
 Chris Blake wrote:
 
 Greetings PHP(eople),
 
 I have a wget process that runs to download a file from a web site,
 
 
 Why would you do that ? There're bultin functions in PHP for doing it.

wget was the first thing I thought of  :)

--
Chris Blake 
Cell: 082 775 1492
Work: +27 11 782 0840
Fax : +27 11 782 0841
Mail: [EMAIL PROTECTED]

A woman was in love with fourteen soldiers. It was clearly platoonic.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php wget: Return an empty file

2005-04-08 Thread Josip Dzolonga
Chris Blake wrote:
wget was the first thing I thought of  :)
You thought wrong :-) Are you are going to parse the file after you've 
downloaded it ? See this function, http://www.php.net/file_get_contents 
, if allow_url_fopen is set to TRUE in your php.ini, there will be no 
problems opening a URL, so $contents = file_get_contents($url); is going 
to to the job perfectly !

Hope this helps,
--
Josip Dzolonga
http://josip.dotgeek.org
jdzolonga[at]gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php