错误: Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in D:\WWW\Connect2.0\API\class\URL.class.php on line 49Warning: file_get_contents(https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=101142852&redirect_uri=www.dai.com%2FConnect2.0%2Fexample%2Foauth%2Fcallback.php&client_secret=f87a05c14b5a97ae0831584fdd34cee9&code=EEBC6839825A1F221B6C633F24D527AF): failed to open stream: No error in D:\WWW\Connect2.0\API\class\URL.class.php on line 49 解决:public function get_contents($url){ //if (ini_get("allow_url_fopen") == "1") { // $response = file_get_contents($url); //}else{ $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_URL, $url); $response = curl_exec($ch); curl_close($ch); //} //-------请求为空 if(empty($response)){ $this->error->showError("50001"); }
http://wiki.open.qq.com/wiki/website/SDK%E4%B8%8B%E8%BD%BD$qc = new QC();
$qc->qq_login();$token = $qc->qq_callback();
$openid = $qc->get_openid();
就这么几行搞定
127.0.0.1 www.xxx.com
www.xxx.com就是你在QQ申请appid的管理页面设置好回调的网址,并且要将测试的QQ号添加到测试用户那一栏
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in D:\WWW\Connect2.0\API\class\URL.class.php on line 49Warning: file_get_contents(https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=101142852&redirect_uri=www.dai.com%2FConnect2.0%2Fexample%2Foauth%2Fcallback.php&client_secret=f87a05c14b5a97ae0831584fdd34cee9&code=EEBC6839825A1F221B6C633F24D527AF): failed to open stream: No error in D:\WWW\Connect2.0\API\class\URL.class.php on line 49
解决:public function get_contents($url){
//if (ini_get("allow_url_fopen") == "1") {
// $response = file_get_contents($url);
//}else{
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $url);
$response = curl_exec($ch);
curl_close($ch);
//} //-------请求为空
if(empty($response)){
$this->error->showError("50001");
}
extension=php_openssl.dll
重启服务器