By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,748 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,748 IT Pros & Developers. It's quick & easy.

PHP Error Messages as String in a Variable

P: n/a
Hi,
Can I put all errors which PHP outputs when error_reporting(E_ALL); is
activated into a variable? I want to react if an error occurs.
I'm working on a Script to check if an ftp is running or not. The only way
to get the error message of the ftp when the connection fails is if
error_reporting(E_WARNING); or error_reporting(E_ALL); is activated. I want
to format the Error Message. E.g. The errormessage is:
Warning: ftp_login() [function.ftp-login]: Sorry, Over 2 connection not
allow in c:\inetpub\wwwroot\scripts\vbb_ftp.php on line 13.

I only want this output: "Status: Sorry, Over 2 connection not allow "
Thx for your help!
Benjamin Dickgießer
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

On 16-Oct-2003, "Benjamin Dickgießer" <Be******@dickgiesser.net> wrote:
Can I put all errors which PHP outputs when error_reporting(E_ALL); is
activated into a variable? I want to react if an error occurs.
I'm working on a Script to check if an ftp is running or not. The only way
to get the error message of the ftp when the connection fails is if
error_reporting(E_WARNING); or error_reporting(E_ALL); is activated. I
want
to format the Error Message. E.g. The errormessage is:
Warning: ftp_login() [function.ftp-login]: Sorry, Over 2 connection not
allow in c:\inetpub\wwwroot\scripts\vbb_ftp.php on line 13.


You can trap the errors with an error handling function see
set_errror_handler()

It seems to me that checking the error return from the function would be
easier.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.