Re: Testing PHP FTP connection( (if still connected)
| From: | Aziz Saleh | Date: | Tue, 18 Feb 2014 16:40:43 +0000 |
| Subject: | Re: Testing PHP FTP connection( (if still connected) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322922@lists.php.net to get a copy of this message | ||
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