note 106302 deleted from book.ftp by danbrown
| From: | danbrown@php.net | Date: | Wed, 26 Oct 2011 16:06:07 +0000 |
| Subject: | note 106302 deleted from book.ftp by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184142@lists.php.net to get a copy of this message | ||
Note Submitter: menendezpoo at gmail dot com
----
tendrid class was actually great, but a little better functionallity may be added:
<?php
class ftp{
public $conn;
public function __construct($url){
$this->conn = ftp_connect($url);
}
public function __call($func,$a){
if(function_exists('ftp_' .$func)){
array_unshift($a,$this->conn);
return call_user_func_array('ftp_' . $func, $a);
}else{
// replace with your own error handler.
die("$func is not a valid FTP function");
}
}
function __destruct(){
if($this->conn)
ftp_close($this->conn);
}
}
// Example
$ftp = new ftp('server.com');
$ftp->login('user','password');
var_dump($ftp->nlist('.'));