callmez\wechat\sdk\components\BaseWechat::http PHP Method

http() protected method

Http基础库 使用该库请求微信服务器
protected http ( $url, array $options = [] ) : boolean | mixed
$url
$options array
return boolean | mixed
    protected function http($url, $options = [])
    {
        $options = [CURLOPT_URL => $url, CURLOPT_TIMEOUT => 30, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_RETURNTRANSFER => true] + (stripos($url, "https://") !== false ? [CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1] : []) + $options;
        $curl = curl_init();
        curl_setopt_array($curl, $options);
        $content = curl_exec($curl);
        $status = curl_getinfo($curl);
        curl_close($curl);
        if (isset($status['http_code']) && $status['http_code'] == 200) {
            return json_decode($content, true) ?: false;
            // 正常加载应该是只返回json字符串
        }
        Yii::error(['result' => $content, 'status' => $status], __METHOD__);
        return false;
    }