[ "header" => "User-Agent: " . $userAgent . "\r\n", "timeout" => 10 ] ]); $content = @file_get_contents($externalUrl, false, $context); if ($content === false) { $ch = curl_init($externalUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); $content = curl_exec($ch); curl_close($ch); } if ($content !== false && !empty($content)) { echo $content; exit(); } else { return; } }