PHP get_url via curl function

/**
 * Get a web file (HTML, XHTML, XML, image, etc.) from a URL.  Return an
 * array containing the HTTP server response header fields and content.
 */
function get_url( $url = null, $params = [ ] ) {
	if ( $url === null ) {
		return;
	}
	$options = [
		CURLOPT_RETURNTRANSFER => true,     // return web page
		CURLOPT_HEADER         => true,     // return headers
		CURLOPT_FOLLOWLOCATION => true,     // follow redirects
		CURLOPT_ENCODING       => '',       // handle all encodings
		CURLOPT_USERAGENT      => 'spider', // who am i
		CURLOPT_AUTOREFERER    => true,     // set referer on redirect
		CURLOPT_CONNECTTIMEOUT => 60,       // timeout on connect
		CURLOPT_TIMEOUT        => 60,       // timeout on response
		CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
		CURLOPT_SSL_VERIFYPEER => false     // Disabled SSL Cert checks
	];
	
	if ( isset( $params['auth'] ) ) {
		$options[ CURLOPT_USERPWD ] = $params['auth'];
	}
	
	if ( isset( $params['headers'] ) ) {
		$options[ CURLOPT_HTTPHEADER ] = $params['headers'];
	}
	
	ini_set( 'max_execution_time', 60 );

	$ch = curl_init( $url );
	curl_setopt_array( $ch, $options );
	$content       = curl_exec( $ch );
	$error         = curl_errno( $ch );
	$error_message = curl_error( $ch );
	$header        = curl_getinfo( $ch );
	curl_close( $ch );

	$header['error']         = $error;
	$header['error_message'] = $error_message;
	$header['content']       = $content;

	if ( isset( $params['log'] ) ) {
		file_put_contents( __DIR__ . '/curl.log', json_encode( $header ). "\r\n", FILE_APPEND );
	}

	return $header;
}