Re: Testing PHP FTP connection( (if still connected)

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

 



On Mon, Feb 17, 2014 at 10:42 PM, Ron Piggott <
ron.piggott@xxxxxxxxxxxxxxxxxx> wrote:

> Is there a way to test if the FTP connection is still live?  Ron
>
> Ron Piggott
>
>
>
> www.TheVerseOfTheDay.info
>

One way (You can replace your ftp_rawlist with any other file listing
function that returns array):

if (ftp_rawlist($connectionId, '/') === false) { //reconnect}

At first I was going to say to use get_resource_type($connectionId) == 'FTP
Buffer' but then noticed that after the regular FTP timeout, the resource
is still the same. is_resource will still consider the variable a resource
even after a timeout.

Aziz

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux