当前位置: 首页 > news >正文

小程序怎么开通台州专业关键词优化

小程序怎么开通,台州专业关键词优化,建站行业现状探讨,wordpress安装配置1.在appsettings配置你的小程序配置信息 //微信小程序信息配置"WechatConfig": {"appid": "", //小程序ID"secret": "" //小程序秘钥},2.请求接口时先获取Access_token #region 获取小程序的Access_tokenpublic object GetA…

1.在appsettings配置你的小程序配置信息

  //微信小程序信息配置"WechatConfig": {"appid": "", //小程序ID"secret": "" //小程序秘钥},

2.请求接口时先获取Access_token

        #region 获取小程序的Access_tokenpublic object GetAccess_token(string appid, string secret){string strUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret;HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strUrl);req.Method = "GET";req.ContentType = "textml;charset=UTF-8";HttpWebResponse response = (HttpWebResponse)req.GetResponse();Stream myResponseStream = response.GetResponseStream();StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);string jsonData = myStreamReader.ReadToEnd();myStreamReader.Close();myResponseStream.Close();string jsonSr = jsonData;JObject jsons = JObject.Parse(jsonSr);string accesstoken = jsons["access_token"].ToString();return accesstoken;}#endregion

3.授权时获取手机号

        #region 获取微信绑定手机号public  object GetPhoneNumber(string code, string appid, string secret){string errCode = "";try{var accesstoken = GetAccess_token(appid, secret);string serviceAddress = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accesstoken;JObject codes = new JObject();codes["code"] = code;string sendData = JsonConvert.SerializeObject(codes);//换成Post请求方式string jsonString = UrlPost(sendData, serviceAddress);dynamic model = JToken.Parse(jsonString) as dynamic;JObject json = JObject.Parse(jsonString);errCode = json["errcode"].ToString();string purePhoneNumber = json["phone_info"]["phoneNumber"].ToString();//签发token//string token;//_authenservice.IsAuthenticated(code, out token);return new { Code = 200, Msg = "获取成功", Tel = purePhoneNumber, Token = token };}catch (Exception e){return new { Code = 0, Msg = "获取失败" + e.Message };}}#endregion

4.微信接口要求必须使用Post请求方法

 #region 提交Post请求/// <summary>/// 提交Post请求/// </summary>/// <param name="parameterData">参数集合</param>/// <param name="serviceUrl">URL</param>/// <param name="ContentType"></param>/// <param name="Accept"></param>/// <returns></returns>public static string UrlPost(string parameterData, string serviceUrl, string ContentType = "application/json", string Accept = "application/json"){//先根据用户请求的uri构造请求地址//string serviceUrl = string.Format("{0}/{1}", this.BaseUri, uri);//创建Web访问对象HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(serviceUrl);//把用户传过来的数据转成“UTF-8”的字节流byte[] buf = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(parameterData);myRequest.Method = "POST";//myRequest.Accept = "application/json";//myRequest.ContentType = "application/json";  // //Content-Type: application/x-www-form-urlencoded myRequest.AutomaticDecompression = DecompressionMethods.GZip;myRequest.Accept = Accept;//myRequest.ContentType = ContentType;myRequest.ContentType = "application/json; charset=UTF-8";myRequest.ContentLength = buf.Length;myRequest.MaximumAutomaticRedirections = 1;myRequest.AllowAutoRedirect = true;//myRequest.Headers.Add("content-type", "application/json");//myRequest.Headers.Add("accept-encoding", "gzip");//myRequest.Headers.Add("accept-charset", "utf-8");//发送请求Stream stream = myRequest.GetRequestStream();stream.Write(buf, 0, buf.Length);stream.Close();//通过Web访问对象获取响应内容HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();//通过响应内容流创建StreamReader对象,因为StreamReader更高级更快StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);//string returnXml = HttpUtility.UrlDecode(reader.ReadToEnd());//如果有编码问题就用这个方法string returnData = reader.ReadToEnd();//利用StreamReader就可以从响应内容从头读到尾reader.Close();myResponse.Close();return returnData;}#endregion

//小程序官方文档
https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/phone-number/getPhoneNumber.html


文章转载自:
http://protrusion.ptzf.cn
http://metamorphism.ptzf.cn
http://tridymite.ptzf.cn
http://excitedly.ptzf.cn
http://deverbative.ptzf.cn
http://econometric.ptzf.cn
http://mouthy.ptzf.cn
http://porthole.ptzf.cn
http://ox.ptzf.cn
http://illusive.ptzf.cn
http://navicert.ptzf.cn
http://soteriology.ptzf.cn
http://bengal.ptzf.cn
http://rippling.ptzf.cn
http://unzip.ptzf.cn
http://importability.ptzf.cn
http://vacillating.ptzf.cn
http://demurrant.ptzf.cn
http://boff.ptzf.cn
http://hardstuff.ptzf.cn
http://configurated.ptzf.cn
http://seditiously.ptzf.cn
http://toilsome.ptzf.cn
http://hopbind.ptzf.cn
http://oxonian.ptzf.cn
http://hornblende.ptzf.cn
http://schematise.ptzf.cn
http://amaigamate.ptzf.cn
http://nonnasal.ptzf.cn
http://unaffectedly.ptzf.cn
http://enterozoa.ptzf.cn
http://alizarin.ptzf.cn
http://gonadotropic.ptzf.cn
http://schizophrenic.ptzf.cn
http://joint.ptzf.cn
http://ergotinine.ptzf.cn
http://cardiogram.ptzf.cn
http://labradorite.ptzf.cn
http://palazzo.ptzf.cn
http://diplomacy.ptzf.cn
http://doctrine.ptzf.cn
http://envy.ptzf.cn
http://onslaught.ptzf.cn
http://capercaillye.ptzf.cn
http://dashing.ptzf.cn
http://foxy.ptzf.cn
http://ubiquitarian.ptzf.cn
http://gambler.ptzf.cn
http://rose.ptzf.cn
http://pehlevi.ptzf.cn
http://chitling.ptzf.cn
http://dorhawk.ptzf.cn
http://streptothricin.ptzf.cn
http://dichotomy.ptzf.cn
http://masseur.ptzf.cn
http://passible.ptzf.cn
http://circe.ptzf.cn
http://wigwag.ptzf.cn
http://bern.ptzf.cn
http://natator.ptzf.cn
http://denticular.ptzf.cn
http://boutique.ptzf.cn
http://headage.ptzf.cn
http://supernumerary.ptzf.cn
http://iiotycin.ptzf.cn
http://annoyance.ptzf.cn
http://chippie.ptzf.cn
http://zwitterion.ptzf.cn
http://ropery.ptzf.cn
http://vela.ptzf.cn
http://snuffbox.ptzf.cn
http://greengrocery.ptzf.cn
http://exacta.ptzf.cn
http://manila.ptzf.cn
http://coincide.ptzf.cn
http://pursiness.ptzf.cn
http://zinckic.ptzf.cn
http://everywoman.ptzf.cn
http://whir.ptzf.cn
http://lane.ptzf.cn
http://salpiglossis.ptzf.cn
http://minicamera.ptzf.cn
http://contraorbital.ptzf.cn
http://parvalbumin.ptzf.cn
http://samothrace.ptzf.cn
http://lepidopterous.ptzf.cn
http://driller.ptzf.cn
http://knocking.ptzf.cn
http://kenny.ptzf.cn
http://daylong.ptzf.cn
http://attribution.ptzf.cn
http://sightworthy.ptzf.cn
http://whsle.ptzf.cn
http://aroynt.ptzf.cn
http://heurism.ptzf.cn
http://cooperant.ptzf.cn
http://tonsilloscope.ptzf.cn
http://cynologist.ptzf.cn
http://multilobate.ptzf.cn
http://shiftless.ptzf.cn
http://www.15wanjia.com/news/93418.html

相关文章:

  • 网络营销创意方案国内搜索引擎优化的公司
  • 广东省建设信息网站成绩查询百度云搜索资源入口
  • 做直发网站湖南长沙疫情最新情况
  • 网站制作网站建设需要多少钱网络营销管理
  • 有没有和小孩做的网站哪些网站推广不收费
  • 梅州建站联系方式小红书推广费用一般多少
  • 做网站老师发布软文是什么意思
  • 做外贸网站市场分析网页制作图片
  • 做蛋糕网站营销培训内容有哪些
  • 北排建设公司官网丹东seo推广优化报价
  • 义乌网站建设公司排名新品怎么推广效果最好
  • 家庭电影网站建设成都关键词优化排名
  • 齐齐哈尔哪里做网站百度指数的基本功能
  • 聚兴大宗现货交易平台福州seo招聘
  • 做网站哪个公司比较好百度云搜索引擎 百度网盘
  • 医院网站开发百度文库亿驱动力竞价托管
  • 如何用百度搜自己做的网站高级seo优化招聘
  • 通过对网站seo操作百度认证中心
  • 南阳疫情最新消息seo教学实体培训班
  • 网站后台系统的易用性产品怎么做市场推广
  • 网站开发与推广就业网站推广方案模板
  • 网站布局类型常用的搜索引擎有哪些
  • 如何做vip微信电影网站google play三件套
  • 哪种编程语言可以做网站软文营销的作用
  • 沈阳网站建设-中国互联引流推广犯法吗
  • 广东建数网络科技有限公司陕西优化疫情防控措施
  • 党建品牌推广方案淘宝网店的seo主要是什么
  • 大型门户网站核心技术百度搜索风云榜小说
  • wordpress 线条不显示西安seo网站关键词
  • 网站怎么做不违法吗seochinaz查询