Unity弱联网 HTTP post,get弱联网写法
public void getRankD(){ Dictionary<string,string> data = new Dictionary<string,string>(); data.Add ("command", "Ranking_Order_Access"); data.Add ("sessionKey", "FA9A4172E6F91F4897829B6AA762811E"); data.Add ("imei", GMUTILS.getIMEI()); data.Add ("game_id", "8"); data.Add ("type", "1"); data.Add ("order_type", "2"); data.Add ("order_value", "2-4"); StartCoroutine (POST(MAINURL,data)); } IEnumerator POST(string url,Dictionary<string,string> data){ //1.新建一张提交表单 WWWForm dataForm = new WWWForm (); //2.装载数据 foreach (KeyValuePair<string,string >postParams in data) { Debug.Log (postParams.Key); dataForm.AddField (postParams.Key, postParams.Value); } //3.创建POST实体 www = new WWW (url, dataForm); yield return www; mProgress = www.progress; if (www.error != null) { mContent = www.error; } else { mContent = www.text; } Debug.Log (mContent); Debug.Log ("session---->"+ GMUTILS.getValueByKey (mContent, "sessionKey")); } IEnumerator GET(string url){ www = new WWW (url); yield return www; mProgress = www.progress; if (www.error != null) { mContent = www.error; Debug.Log ("Error"); } else { mContent = www.text; } }
本文作者:StanWind
文章标题: Unity弱联网 HTTP post,get弱联网写法
本文地址:https://www.stanwind.com/post/24
版权声明:若无注明,本文皆为“Make it Better”原创,转载请保留文章出处。
本文地址:https://www.stanwind.com/post/24
版权声明:若无注明,本文皆为“Make it Better”原创,转载请保留文章出处。
相关文章
- Unity移动方式总结
- 仿造Netty写的C#版ByteBuffer 用于unity
- Unity对ipv6的支持 (针对IOS上架要求)
- DoTween Demo
- Unity弱联网 HTTP post,get弱联网写法
- IOS、Unity接入微信登录出现不跳转 发送短信登录微信的情况
- Unity使用admob导出ios工程编译失败 use of '@import' when modules are disabled
- Mac上获取keystore的 SHA1
- Mac上如何多开unity
- IOS接入ShareSDK出现'NSInvalidArgumentException', reason: '-[__NSArrayM enqueue:]: unrecognized selector