鱼跃设计

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
鱼跃设计 首页 discuz开发进程 查看内容

unity读取网页数据方法

2020-7-5 15:11| 发布者: 鱼跃设计| 查看: 37| 评论: 0

摘要: using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using System.Runtime.InteropServices;using System;using System.Net;using System.Text;public class Login ...
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Runtime.InteropServices;
using System;
using System.Net;
using System.Text;
public class Login : MonoBehaviour {

    //联网使用功能
    public string yanZhengFanHui = "lianwang";
    private string url = "http://yuyuesheji.com/yz/yanzheng.html";

    void Start() 
    {
        XinyanZheng();
    }

    void XinyanZheng()
    {
        WebClient myWebClient = new WebClient();
        myWebClient.Credentials = CredentialCache.DefaultCredentials;
        byte[] pageData = myWebClient.DownloadData(url);
        string pageHtml = Encoding.UTF8.GetString(pageData);
        yanZhengFanHui = pageHtml;
    }

    public void LogoinOK()
    {
        if (yanZhengFanHui == "ok")//激活码有效
        {
           
        }
        else//激活码无效
        {
          
        }
    }

   
}

鲜花

握手

雷人

路过

鸡蛋

Archiver|手机版|小黑屋|鱼跃设计 ( 鲁ICP备17022873号-8 )

GMT+8, 2020-10-26 11:19 , Processed in 0.091586 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部