Welcome Guest, Not a member yet? Register   Sign In
CI_FTP class - error handling for ftp->connect?
#1

[eluser]Myles Wakeham[/eluser]
Looking for some 'best practices' on this. I have to connect to a dozen different servers in a round-robin arrangement, copying files to each via FTP. I need a way to ensure that ftp->connect doesn't fail, and if it does handle it gracefully.

Other than reading debug messages (which won't work for me since a human won't be doing this), is there any return value that can be tested for ftp->connect or some other way to test if the connection succeeded?

Thanks
Myles
#2

[eluser]TheFuzzy0ne[/eluser]
It really is as simple as you might expect it to be.
Code:
if ($this->ftp->connect())
{
    // Woohoo!
}
else
{
    // D'oh!!
}
#3

[eluser]Myles Wakeham[/eluser]
I was hoping for an answer like that! Smile

Thanks. Next time I'll check the source on it.

Myles




Theme © iAndrew 2016 - Forum software by © MyBB