Whilst working on updates, I wrote the following to ensure the site was actually online;
function isURLOnline($sSiteToCheck){
$sIUOTemp = @get_headers($sSiteToCheck);
if(strpos($sIUOTemp[0], '200') == true){
return true;
}else{
return false;
}
}This was originally using is_array() to ensure it actually returned headers, but for some reason, it borked when using it, so I removed that part and left it as above

.
New getURL code;
function getURL($sURL){
if(isURLOnline($sURL) == true){
if(function_exists('file_get_contents')){
// Use file_get_contents
$sURLTemp = @file_get_contents($sURL);
}else{
// Use cURL (if available)
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $sURL);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$sURLTemp = @curl_exec($curl);
curl_close($curl);
}
return $sURLTemp;
}else{
$sURLTemp = 'Unable to connect to server';
return $sURLTemp;
}
}