Iqiyi::_cget PHP Method

_cget() private static method

通过 curl 获取内容
private static _cget ( $url = '' )
    private static function _cget($url = '')
    {
        if (!$url) {
            return;
        }
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_REFERER, "http://www.baidu.com");
        curl_setopt($ch, CURLOPT_USERAGENT, self::USER_AGENT);
        ob_start();
        curl_exec($ch);
        $html = ob_get_contents();
        ob_end_clean();
        if (curl_errno($ch)) {
            curl_close($ch);
            return false;
        }
        curl_close($ch);
        if (!is_string($html) || !strlen($html)) {
            return false;
        }
        return $html;
    }