/** * __construct * * @param string $user * @param string $pass * @param string $host * @param int $port */ public function __construct($user = '******', $pass = '', $host = 'localhost', $port = 21) { $host = NetworkWrapper::set($host); $this->_res = ftp_connect($host, $port, 10); ftp_login($this->_res, $user, $pass); ftp_pasv($this->_res, true); $this->_setSysType(ftp_systype($this->_res)); // URL //$this->_url = 'ftp://' . $user . ':' . $pass . '@' . $host . ':' . $port; }
/** * getIp * * @param string $url * @return string */ public function getIp($url = '') { $url = NetworkWrapper::set($url); return implode(', ', gethostbynamel(parse_url($url, PHP_URL_HOST))); }