看了官方文档,但是不知道代码怎样实现?希望各位大神提供大致思路和方法,不胜感激!!!
1、推送component_verify_ticket 出于安全考虑,在第三方平台创建审核通过后,微信服务器每隔10分钟会向第三方的消息接收地址推送一次component_verify_ticket,用于获取第三方平台接口调用凭据
2、获取第三方平台component_access_token 第三方平台通过自己的component_appid(即在微信开放平台管理中心的第三方平台详情页中的AppID和AppSecret)和component_appsecret,以及component_verify_ticket(每10分钟推送一次的安全ticket)来获取自己的接口调用凭据(component_access_token)
3、获取预授权码pre_auth_code 第三方平台通过自己的接口调用凭据(component_access_token)来获取用于授权流程准备的预授权码(pre_auth_code)
1、推送component_verify_ticket 出于安全考虑,在第三方平台创建审核通过后,微信服务器每隔10分钟会向第三方的消息接收地址推送一次component_verify_ticket,用于获取第三方平台接口调用凭据
2、获取第三方平台component_access_token 第三方平台通过自己的component_appid(即在微信开放平台管理中心的第三方平台详情页中的AppID和AppSecret)和component_appsecret,以及component_verify_ticket(每10分钟推送一次的安全ticket)来获取自己的接口调用凭据(component_access_token)
3、获取预授权码pre_auth_code 第三方平台通过自己的接口调用凭据(component_access_token)来获取用于授权流程准备的预授权码(pre_auth_code)
$xml = file_get_contents('php://input');
但我这样获取的$xml为空,,
肿么办
这个你是写在哪里的?ticket是提交到你申请应用是写的授权接收URL上的,每隔10分钟会定时推送的,如下图标注的红色框位置:
我在
public function authListener() {
$xml = file_get_contents('php://input');
}
测试获取的$xml为空,,,不知道哪儿出问题了
/// 获取预授权码
/// </summary>
/// <param name="componentAppId">第三方平台方appid</param>
/// <param name="componentAccessToken"></param>
/// <param name="timeOut"></param>
/// <returns></returns>
public static PreAuthCodeResult GetPreAuthCode(string componentAppId, string componentAccessToken, int timeOut = Config.TIME_OUT)
{
var url =
string.Format(
"https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token={0}",
componentAccessToken.AsUrlData()); var data = new
{
component_appid = componentAppId
}; return CommonJsonSend.Send<PreAuthCodeResult>(null, url, data, CommonJsonSendType.POST, timeOut);
}