array( 'method' => 'GET', 'timeout' => $timeout, 'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0)' .' Gecko/20100101 Firefox/23.0' ) ); $context = stream_context_create($options); try { // TODO: catch Exception in calling code (thumbnailer) $content = file_get_contents($url, false, $context, -1, $maxBytes); } catch (Exception $exc) { return array(array(0 => 'HTTP Error'), $exc->getMessage()); } if (!$content) { return array(array(0 => 'HTTP Error'), ''); } return array(get_headers($url, 1), $content); }