ftp_base::get()publicWP 1.0

Метод класса: ftp_base{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ftp_base = new ftp_base();
$ftp_base->get( $remotefile, $localfile, $rest );
$remotefile (обязательный)
-
$localfile **
-
По умолчанию: NULL
$rest **
-

Код ftp_base::get() WP 6.5.2

function get($remotefile, $localfile=NULL, $rest=0) {
	if(is_null($localfile)) $localfile=$remotefile;
	if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
	$fp = @fopen($localfile, "w");
	if (!$fp) {
		$this->PushError("get","cannot open local file", "Cannot create \"".$localfile."\"");
		return FALSE;
	}
	if($this->_can_restore and $rest!=0) fseek($fp, $rest);
	$pi=pathinfo($remotefile);
	if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
	else $mode=FTP_BINARY;
	if(!$this->_data_prepare($mode)) {
		fclose($fp);
		return FALSE;
	}
	if($this->_can_restore and $rest!=0) $this->restore($rest);
	if(!$this->_exec("RETR ".$remotefile, "get")) {
		$this->_data_close();
		fclose($fp);
		return FALSE;
	}
	if(!$this->_checkCode()) {
		$this->_data_close();
		fclose($fp);
		return FALSE;
	}
	$out=$this->_data_read($mode, $fp);
	fclose($fp);
	$this->_data_close();
	if(!$this->_readmsg()) return FALSE;
	if(!$this->_checkCode()) return FALSE;
	return $out;
}