收藏
回答

获取直播间列表 返回错误?

返回:{"errcode":43002,"errmsg":"require POST method hint: [pklFSbMre-] rid: 5fe34695-189c82be-5a3f6937"}

代码:

string url = "http://api.weixin.qq.com/wxa/business/getliveinfo?access_token={0}";

                string token = JsCode2Session();

                string serviceUrl = string.Format(url, token);

                var httpWebRequest = (HttpWebRequest)WebRequest.Create(serviceUrl);

                httpWebRequest.ContentType = "application/json;charset=utf8"; //;charset=UTF-8

                httpWebRequest.Method = "POST";


                using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))

                {

                    string json = "{\"strat\":\""+ strat + "\",\"limit\":\""+ limit + "\"}";

                    streamWriter.Write(json);

                    streamWriter.Flush();

                    streamWriter.Close();

                }

                var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))

                {

                    var result = streamReader.ReadToEnd();

                    return ResultJson("成功", result, 0);

                }


回答关注问题邀请回答
收藏

1 个回答

  • Mr.Zhao
    Mr.Zhao
    2020-12-23

    用https

    2020-12-23
    有用
    回复 2
    • 南城雨落
      南城雨落
      2020-12-24
      https 错误编码:47001
      2020-12-24
      回复
    • Mr.Zhao
      Mr.Zhao
      2020-12-24回复南城雨落
      json格式化错误 我建议你用开源的工具类
      2020-12-24
      回复
登录 后发表内容
问题标签