• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/web/httpclient.php
  • Класс: BitrixMainWebHttpClient
  • Вызов: HttpClient::download
public function download($url, $filePath)
{
	$dir = IOPath::getDirectory($filePath);
	IODirectory::createDirectory($dir);

	$result = $this->query(HttpMethod::GET, $url);

	if ($result && ($status = $this->getStatus()) >= 200 && $status < 300)
	{
		$file = new IOFile($filePath);
		$handler = $file->open('w+');

		$this->setOutputStream($handler);

		$this->getResult();

		$file->close();

		return true;
	}

	return false;
}