微信订阅号,获取用户openid
在微信后台,启用服务器配置。
服务器URL地址,要通过Token的验证。
private void Auth()
{
string token = ConfigurationManager.AppSettings["WeixinToken"];//从配置文件获取Token
if (string.IsNullOrEmpty(token))
{
LogTextHelper.Error(string.Format("WeixinToken 配置项没有配置!"));
} string echoString = HttpContext.Current.Request.QueryString["echoStr"];
string signature = HttpContext.Current.Request.QueryString["signature"];
string timestamp = HttpContext.Current.Request.QueryString["timestamp"];
string nonce = HttpContext.Current.Request.QueryString["nonce"]; if (CheckSignature(token, signature, timestamp, nonce))
{
if (!string.IsNullOrEmpty(echoString))
{
HttpContext.Current.Response.Write(echoString);
HttpContext.Current.Response.End();
}
}
}
关注订阅号,发一个文本消息。里面有用户的openid
/// <summary>
/// 主入口
/// </summary>
/// <param name="msg"></param>
private void OnRecvEvent(ReqMsgEventBase msg)
{
switch (msg.Event)
{
case Event.LOCATION:
break;
case Event.subscribe:
string content = “openid=”+msg.FromUserName;
SendResponseText(msg, content);
break;
case Event.unsubscribe:
break;
default:
break;
} }
微信订阅号,获取用户openid的更多相关文章
- 微信订阅号 获取用户基本信息,登录及 php
<?php //echo file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_cr ...
- 微信公众号获取用户openId How to use cURL to get jSON data and decode the data?
w http://stackoverflow.com/questions/16700960/how-to-use-curl-to-get-json-data-and-decode-the-data
- ASP.NET Core2实现静默获取微信公众号的用户OpenId
最近在做个微信公众号的项目,需要将入口放置在公众号二级菜单内,通过点击该菜单链接后进入到该项目中去,进入到项目后程序会自动通过微信公众号的API完成用户的OpenId获取.需求很简单,实现起来也不复杂 ...
- 微信公众号获取粉丝openid系统
做为一名开发人员,在测试当中也经常需要用到openid,但是微信公众号获取openid的方法也是特别麻烦!网页授权是最常见的方式, 但是网页授权的流程太复杂,不仅要开发,还要在公众号后台设置回调域名( ...
- 微信网页授权获取用户openid及用户信息
$code = $_GET["code"];//获取code $appid=“xxxx”;//公众号appid $APPSECRET="xxx";//公众号ap ...
- php,微信公众号,获取用户地理位置 定位 经纬度
<?php //php插件下载地址: https://files.cnblogs.com/files/fan-bk/jssdk_php.rar //建立一个php文件 require_once ...
- java 获取微信 页面授权 获取用户openid
先调用微信的地址 跳转https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4b4009c4fce00e0c&redirect ...
- 微信小程序 获取用户openid
1,可以在小程序app.js入口文件中放入登录代码 wx.login({ success: res => { // 登录注册接口 if (res.code) { // 调用服务端登录接口,发送 ...
- 微信小程序获取用户openid,头像昵称信息,后台java代码
https://blog.csdn.net/qq_39851704/article/details/79025557
- 微信公众号订阅号以及服务号通过网页授权获取用户openid方法
微信官方文档:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842 官方流程 网页授权流程分为四步: 1.引导用户 ...
随机推荐
- Android Studio 使用USB真机调试教程
允许安装未知来源的软件 允许USB调试 设置启动方式 选择USB device 然后运行 会自动安装软件启动! 参考: https://blog.csdn.net/fubo1990/article/d ...
- 如何连接oracle 12c可插拔数据库
启动根容器:[oracle@eric ~]$ export ORACLE_SID=cup[oracle@eric ~]$ sqlplus / as sysdbaSQL*Plus: Release 12 ...
- [工具]cmd命令大全
cmd命令大全(第一部分) winver---------检查Windows版本 wmimgmt.msc----打开windows管理体系结构(WMI) wupdmgr--------window ...
- C++的虚函数
1 多态产生的背景 希望同一个方法在派生类和基类中的行为是不同的,换句话来说,方法的行为取决于调用该方法的对象. 2 解决多态的两种方法 1)在派生类中重新定义基类的方法 2)使用虚方法 3 虚 ...
- JAVA基础知识总结:十六
一.File类 主要用于文件操作 对存储在磁盘上的文件和目录的抽取和封装 二.IO流 1.概念 File类只能创建或者修改文件或者文件夹的层级结构,如果要访问文件中的内容的话,就需要用到IO流(Inp ...
- Python数据分析-Day1-Numpy模块
1.numpy.genfromtxt读取txt文件 import numpyworld_alcohol = numpy.genfromtxt("world_alcohol.txt" ...
- Android 如何将手机屏幕投影到 PC 屏幕上或者投影仪上做演示?
Android 如何将手机屏幕投影到 PC 屏幕上或者投影仪上做演示? 公司开发款APP,要给领导演示,总不能用手机面对面演示吧.所以找了好久,找到一款体验超好的: Total Control-帮助你 ...
- docker安装成功启动失败
docker安装成功却启动失败,查看docker服务,systemctl status docker.service, 服务日志提示Failed to start Docker Application ...
- 把 java web application deploy 到 root
http://stackoverflow.com/questions/5328518/deploying-my-application-at-the-root-in-tomcat You have a ...
- English trip V1 - 11.What's That? 那是什么?Teacher:Patrick Key:There's/There are
In this lesson you will learn to describe the position of an object. 在本课中,您将学习如何描述对象的位置. 课上内容(Lesson ...