note 106302 added to book.ftp

From: Date: Wed, 26 Oct 2011 15:49:40 +0000
Subject: note 106302 added to book.ftp
Groups: php.notes 
Request: Send a blank email to php-notes+get-184141@lists.php.net to get a copy of this message
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('.')); ---- Server IP: 200.36.127.20 Probable Submitter: 127.0.0.1 (proxied: 189.128.125.172) ---- Manual Page -- http://www.php.net/manual/en/book.ftp.php Edit -- https://master.php.net/note/edit/106302 Del: integrated -- https://master.php.net/note/delete/106302/integrated Del: useless -- https://master.php.net/note/delete/106302/useless Del: bad code -- https://master.php.net/note/delete/106302/bad+code Del: spam -- https://master.php.net/note/delete/106302/spam Del: non-english -- https://master.php.net/note/delete/106302/non-english Del: in docs -- https://master.php.net/note/delete/106302/in+docs Del: other reasons-- https://master.php.net/note/delete/106302 Reject -- https://master.php.net/note/reject/106302 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184141) next »