【已解决】获取匿名用户、获取token提示appid invalid
本帖最后由 非相 于 2016-1-2 00:19 编辑发起请求:
<?php
function curl_post($url,$data='',$timeout=30,$header=array()){
$arrCurlResult = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);//ssl检测跳过
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt ( $ch,CURLOPT_REFERER,"");
$output = curl_exec($ch);
$responseCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
$arrCurlResult['output'] = $output;//返回结果
$arrCurlResult['code'] = $responseCode;//返回http状态
curl_close($ch);
unset($ch);
return $arrCurlResult;
}
$header=array(
'Content-Type:application/json',
'X-Gizwits-Application-Id:d144ac6422ca444d8345xxxxxxxx'//appid隐藏了
);
$params=array(
"phone_id"=> "apiary"
);
$params_query=json_encode($params);
$result=@curl_post('http://api.gizwits.com/app/users',$params_query,$header,30);
echo '<pre>';
print_r($result);
?>
返回内容:
Array( => {"error_message":"appid invalid!","error_code":9003,"detail_message":null} => 400)
已解决,发现是参数写错了额 您好,我最近也在用新浪云上的PHP代码调用机智云的Open API ,能交流下吗?我的qq是615838972,谢谢您!!!
您好,我最近也在用新浪云上的PHP代码调用机智云的Open API ,能交流下吗?我的qq是615838972,谢谢您!!!
页:
[1]