function getCurl($url,array $opt = []){ $defaults = [ CURLOPT_URL => $url, CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_TIMEOUT => 5 ]; $ch = curl_init(); curl_setopt_array($ch, ($opt + $defaults)); if(!$result = curl_exec($ch)){ error_log('Curl error: '.curl_error($ch).' url: '.$url); } curl_close($ch); return $result; } echo getCurl('https://wp.wkbr.net');