以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]使用Rest API方式推送消息求助 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=138025) |
-- 作者:ymjr2011 -- 发布时间:2019/7/21 10:52:00 -- [求助]使用Rest API方式推送消息求助 此主题相关图片如下:1.png 上述在FT中应该如何写代码发送消息?
|
-- 作者:ymjr2011 -- 发布时间:2019/7/21 11:00:00 -- string postDataStr = "appkey=your app keyXXXXXXXXXXXXXXXXXXXXXXXXXXX"; //appkey HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://rest-hangzhou.goeasy.io/publish"); request.Method = "POST"; request.C; request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr); Stream myRequestStream = request.GetRequestStream(); byte[] data = Encoding.UTF8.GetBytes(postDataStr); myRequestStream.Write(data, 0, data.Length); Console.WriteLine(data); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream myResponseStream = response.GetResponseStream(); StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); string retString = myStreamReader.ReadToEnd(); Console.WriteLine(retString); Console.ReadLine(); myStreamReader.Close(); myResponseStream.Close();
|
-- 作者:ymjr2011 -- 发布时间:2019/7/21 19:03:00 -- 今天好像没有人 |
-- 作者:有点蓝 -- 发布时间:2019/7/21 21:32:00 -- 使用httpclient有什么问题?http://www.foxtable.com/mobilehelp/scr/0165.htm 接口文档地址反过来看看
|