curl_exec返回false,无法获取accessToken

        $curl = curl_init();
        /*
        curl_setopt_array($curl,
            array(
                CURLOPT_URL => $url,
                CURLOPT_REFERER => $url,
                CURLOPT_AUTOREFERER => true,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_SSL_VERIFYHOST => false,
                CURLOPT_CONNECTTIMEOUT => 1,
                CURLOPT_TIMEOUT => 30,
                CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36'
            )
        );
        */
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl,CURLOPT_URL,$url);
        curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
        //curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
        //curl_setopt($curl, CURLOPT_HEADER, true);
        
        $res = curl_exec($curl);

没有办法获取accessToken真无奈,难道每次都要通过接口调试工具吗?请问老师正确的打开办法?

  • 返回结果:

    • 200 OK

    • Connection: close

    • Date: Mon, 13 Jun 2016 03:25:04 GMT

    • Content-Type: application/json; encoding=utf-8

    • Content-Length: 175

    • {
         "access_token": "####",
         "expires_in": 7198}

  • 提示:

  • Request successful


微笑de迪妮莎
浏览 3343回答 2
2回答

微笑de迪妮莎

找到问题了,返回int(77)  Problem with the SSL CA cert (path? access rights?)linix里面运行了下No package ca-certificate 好吧。curl函数使用环境有问题
打开App,查看更多内容
随时随地看视频慕课网APP