$code=$_GET['code'];
//echo $code; exit;
$url='https://api.weibo.com/oauth2/access_token';
$redirect_uri='...';
$appid='...';
//$url='https://api.weibo.com/oauth2/authorize?client_id='.$appid.'&redirect_uri='.$redirect_uri.'&response_type=code';
$data=array(
'client_id'=>'...',
'client_secret'=>'...',
'grant_type'=>'authorization_code',
'code'=>$code,
'redirect_uri'=>'...'
);
//$postfields=http_build_query($data);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
$output=curl_exec($ch);
if(curl_errno($ch)){
return curl_error($ch);
}
curl_close($ch);
$arr=json_decode($output,true);
var_dump($arr);报错如图,求指导。
2 回答
qq_大寒_2
TA贡献173条经验 获得超185个赞
报错 Fatal error: Call to undefined function curl_init() in D:\wamp\www\test\one.php on line 17 $ch = curl_init();
你是不是没开启curl_init()
- 2 回答
- 0 关注
- 2176 浏览
添加回答
举报
0/150
提交
取消