Airship\Engine\Hail::downloadFile PHP Method

downloadFile() public method

Download a file over the Internet
public downloadFile ( string $url, string $filename, array $params = [] ) : Psr\Http\Message\ResponseInterface
$url string - the URL to request
$filename string - the name of the local file path
$params array
return Psr\Http\Message\ResponseInterface
    public function downloadFile(string $url, string $filename, array $params = []) : ResponseInterface
    {
        $fp = \fopen($filename, 'wb');
        $opts = $this->params($params, $url);
        $opts[\CURLOPT_FOLLOWLOCATION] = true;
        $opts[\CURLOPT_FILE] = $fp;
        $result = $this->client->post($url, $opts);
        \fclose($fp);
        return $result;
    }