Forum Moderators: coopster

Message Too Old, No Replies

How to suppress php_login() warning?

         

nicolant

6:41 am on Apr 30, 2003 (gmt 0)

10+ Year Member



I want to write a script to connect to the ftp server and to notify user about its availability.

When I use ftp_login() I get message "Warning: ftp_login()...". How can I suppress that message? I only want to check returned result (TRUE or FALSE).

I tried to use fsockopen/fputs/fgets, but I don't know all that codes returned in a response ("220 ... FTP ...").

Any help would be appreciated. Thank

dmorison

7:16 am on Apr 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Never used the ftp libs, but does:

@ftp_login()

do the trick? The @ character suppresses error (but i'm not sure about warnings (if there's a difference)) messages generated within a PHP library function.

Also see:

[php.net...]

Hope this helps!

nicolant

9:53 am on Apr 30, 2003 (gmt 0)

10+ Year Member



Thank you! Now I don't have to modify php.ini each time :-)

daisho

2:35 pm on Apr 30, 2003 (gmt 0)

10+ Year Member



As dmorison said for your problem the "@" is the best solutions. This will work on most functions.

You can also look at ini_set rather than editing the php.ini file if you need to change the behaviour for 1 script rather than globally.

daisho