protected function fileGetContents($url, array $params = array())
    {
        if (!ini_get('allow_url_fopen')) {
            throw new \Exception('Could not execute lookup, allow_url_fopen is disabled');
        }

        if (!filter_var($url, FILTER_VALIDATE_URL)) {
            throw new \Exception('Invalid url ' . $url);
        }

        $defaultOptions = array(
            'method' => 'GET',
            'user_agent' => $this->userAgent,
            'follow_location' => 1,
            'max_redirects' => 20,
            'timeout' => 40
        );

        $context = array('http' => array_merge($defaultOptions, $this->config['fopen'], $params));
        if ($data = file_get_contents($url, false, stream_context_create($context))) {
            return $data;
        }

        throw new \Exception('Invalid Server Response from ' . $url);
    }
protected function fileGetContents($url, array $params = array())
    {
        if (!ini_get('allow_url_fopen')) {
            throw new \Exception('Could not execute lookup, allow_url_fopen is disabled');
        }

        if (!filter_var($url, FILTER_VALIDATE_URL)) {
            throw new \Exception('Invalid url ' . $url);
        }

        $defaultOptions = array(
            'method' => 'GET',
            'user_agent' => $this->userAgent,
            'follow_location' => 1,
            'max_redirects' => 20,
            'timeout' => 40
        );

        $context = array('http' => array_merge($defaultOptions, $this->config['fopen'], $params));
        if ($data = file_get_contents($url, false, stream_context_create($context))) {
            return $data;
        }

        throw new \Exception('Invalid Server Response from ' . $url);
    }
protected function fileGetContents ( $ url , array $ params = array ( ) ) { if ( ! ini_get ( 'allow_url_fopen' ) ) { throw new \ Exception ( 'Could not execute lookup, allow_url_fopen is disabled' ) ; } if ( ! filter_var ( $ url , FILTER_VALIDATE_URL ) ) { throw new \ Exception ( 'Invalid url ' . $ url ) ; } $ defaultOptions = array ( 'method' => 'GET' , 'user_agent' => $ this -> userAgent , 'follow_location' => 1 , 'max_redirects' => 20 , 'timeout' => 40 ) ; $ context = array ( 'http' => array_merge ( $ defaultOptions , $ this -> config [ 'fopen' ] , $ params ) ) ; if ( $ data = file_get_contents ( $ url , false , stream_context_create ( $ context ) ) ) { return $ data ; } throw new \ Exception ( 'Invalid Server Response from ' . $ url ) ; }
Uses file_get_contents to fetch data from an url

@param string $url
@param array $params Additional parameters for the respective part
@return string

@throws Exception when allow_url_fopen is disabled or when no data was returned
Uses file_get_contents to fetch data from an url