• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/sftp.php
  • Класс: BitrixSaleTradingPlatformSftp
  • Вызов: Sftp::downloadFile
public function downloadFile($remoteFile, $localFile)
{
	$remotePath = "sftp://".intval($this->sftp).$remoteFile;
	$stream = @fopen("ssh2.".$remotePath, 'r');

	if (!$stream)
		throw new SystemException(Loc::getMessage("TRADING_PLATFORM_SFTP_ERROR_OPEN_FILE", array("#FILE#" => $remotePath)));

	$contents = stream_get_contents($stream);

	if(file_put_contents($localFile, $contents) === false)
		throw new SystemException(Loc::getMessage("TRADING_PLATFORM_SFTP_ERROR_WRITE_FILE", array("#FILE#" => $localFile)));

	@fclose($stream);
	return true;
}