qq 登录api php类(6)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-16 20:04 点击:次
//必要参数,不要随便更改!!
$params = $_POST;
$params["oauth_version"] = “1.0″;
$params["oauth_signature_method"] = “HMAC-SHA1″;
$params["oauth_timestamp"] = time();
$params["oauth_nonce"] = mt_rand();
$params["oauth_consumer_key"] = $appid;
$params["oauth_token"] = $access_token;
$params["openid"] = $openid;
unset($params["oauth_signature"]);
//对参数按照字母升序做序列化
$sigstr .= rawurlencode($this->get_normalized_string($params));
//签名,需要确保php版本支持hash_hmac函数
$key = $appkey.”&”.$access_token_secret;
$signature = $this->get_signature($sigstr, $key);
$params["oauth_signature"] = $signature;
$postdata = $this->get_urlencode_string($params);
//echo “$sigstr******\n”;
//echo “$postdata\n”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_URL, $url);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
}
?>
暂时只有登录功能,后期项目中方法继续更新
摘自 顺子网络 PHP网站建设
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>