首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于SQL的统一3D安全认证

问基于SQL的统一3D安全认证
EN

Stack Overflow用户
提问于 2014-04-26 10:31:30
回答 1查看 3.3K关注 0票数 0

我正在开发一个统一3d的android应用程序,它将有用于用户帐户的网络通信,更新上述帐户,以及控制应用程序后端的所有内容。我统一使用WWW类向服务器发送信息。后端是php,所有数据都存储在mysql数据库中。我怎样才能在应用程序和后端之间建立一个安全的连接,而不需要有人简单地获取服务器地址并将其阻塞在主机文件中,并输入应用程序的假信息并与其联机。(举个例子)我不是安全专家,但我也不确定为了在服务器和客户端之间建立安全连接需要查看哪些内容。任何帮助都会受到极大的伤害。谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-26 20:55:37

您只需要实现www类。

代码语言:javascript
复制
      void start()
      {
        StartCoroutine(retrieveHighscores()); //Start out by getting the current scores.
      }

    IEnumerator retrieveHighscores()
   {

    var form = new WWWForm(); // create a new form


    form.AddField("Nipun",name); // add the data you want to retrieve in the form fields
    var rawData = form.data;
    var headers = form.headers;  // here headers will be used to authenticate the credentials of the person trying to access
    headers["Authorization"]="Basic " + System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes("username:password"));

    WWW webRequest = new WWW("https://abc.com/test.php", rawData, headers); // 

    yield return webRequest;
    if (webRequest != null) {
  //here you have successfully got the response back from the server , here i am adding the whole response in a string and then splitting the string based on the format of the data i received.
                    string x = webRequest.text;
                    string[] lines = webRequest.text.Split(new string[] { System.Environment.NewLine }, System.StringSplitOptions.RemoveEmptyEntries); //Split the response by newlines.
        Debug.Log(x); // to check what you received
                    scores = new Dictionary<string, int>(); //Always reset our scores, as we just got new ones.
                    foreach (string line in lines) //Parse every line
                    {
                        // code here how you want to use the split up data you received
                    }


            }
    else
        Debug.Log("error");
}

}

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23309617

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档