[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] Testing PHP FTP connection( (if still connected)
From:       Aziz Saleh <azizsaleh () gmail ! com>
Date:       2014-02-18 16:40:43
Message-ID: CAPJtNhWKwz3BgRT-uzbLTtm1Bxog-zzZgN1Z6y5sfvUPAJxtFw () mail ! gmail ! com
[Download RAW message or body]


On Mon, Feb 17, 2014 at 10:42 PM, Ron Piggott <
ron.piggott@actsministries.org> 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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic