Skip to content

Instantly share code, notes, and snippets.

@clone1018
Created January 14, 2012 03:25
Show Gist options
  • Save clone1018/1610119 to your computer and use it in GitHub Desktop.
Save clone1018/1610119 to your computer and use it in GitHub Desktop.
<?php
class ftp{
public $conn;
public function __construct($url){
$this->conn = ftp_connect($url);
}
public function __call($func,$a){
if(strstr($func,'ftp_') !== false && function_exists($func)){
array_unshift($a,$this->conn);
return call_user_func_array($func,$a);
}else{
// replace with your own error handler.
die("$func is not a valid FTP function");
}
}
}
// Example
$ftp = new ftp('YOURIP');
$ftp->ftp_login('YOURUSER','YOURPASS');
var_dump($ftp->ftp_nlist("./serviceNUM/plugins/mcMMO"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment