Ejemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     Scaler.Http http = new Scaler.Http();
     IP            = http.GetHTML("http://oa.sdhuijiu.com/ip.aspx", "", "", "", "GET");
     lbListen.Text = IP + ":8205";
 }
Ejemplo n.º 2
0
        public string sign(object stu_id)
        {
            string url = string.Format("http://xuanke.juntaijishu.com/index/lock_test.aspx?b_id=7&s_id={0}&l_id=261&d=fri", stu_id);

            Scaler.Http http = new Scaler.Http();
            http.KeepAlive = false;
            //http.Proxy = "127.0.0.1"; http.ProxyPort = "8888";

            string content = http.GetHTML(url, "", "", "", "GET");

            Scaler.Win.WriteLog(stu_id + "\t" + content);
            Interlocked.Decrement(ref iwork);
            return("");
        }
Ejemplo n.º 3
0
        public string getAccessToken()
        {
            if (!string.IsNullOrEmpty(AccessToken) && DateTime.Now < dtExpire)
            {
                return(AccessToken);
            }
            string url = string.Format("https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id={0}&client_secret={1}", app_key, secret_key);

            Scaler.Http http    = new Scaler.Http();
            string      content = http.GetHTML(url, "", "", "", "GET");

            Newtonsoft.Json.Linq.JObject obj;
            try
            {
                obj = Newtonsoft.Json.Linq.JObject.Parse(content);
            }
            catch (Exception err)
            {
                Scaler.Win.WriteLog("获取Access失败!|" + content + "|" + err.Message);
                return(string.Empty);
            }

            /*{
             *  "access_token": "1.a6b7dbd428f731035f771b8d********.86400.1292922000-2346678-124328",
             *  "expires_in": 2592000,
             *  "refresh_token": "2.385d55f8615fdfd9edb7c4b********.604800.1293440400-2346678-124328",
             *  "scope": "public audio_tts_post ...",
             *  "session_key": "ANXxSNjwQDugf8615Onqeik********CdlLxn",
             *  "session_secret": "248APxvxjCZ0VEC********aK4oZExMB",
             * }*/
            if (!obj.TryGetValue("access_token", out Newtonsoft.Json.Linq.JToken access_token))
            {
                Scaler.Win.WriteLog("获取Access失败!无access_token|" + content);
                return(string.Empty);
            }
            AccessToken = access_token.ToString();
            if (obj.TryGetValue("expires_in", out access_token))
            {
                if (int.TryParse(access_token.ToString(), out int expires))
                {
                    dtExpire = DateTime.Now.AddHours(-1).AddSeconds(expires);
                }
            }
            return(AccessToken);
        }
Ejemplo n.º 4
0
        public string[] getLatLng(string stress)
        {
            Thread.Sleep(1000);
            Scaler.Http http    = new Scaler.Http();
            string      url     = "http://apis.map.qq.com/jsapi?qt=geoc&addr=" + Scaler.Common.StrEncode(stress) + "&output=jsonp&pf=jsapi&ref=jsapi&cb=qq.maps._svcb3.geocoder0";
            string      content = http.GetHTML_WithEncode(url, "", "", "", "GET", Encoding.UTF8, Encoding.Default);

            int l = content.IndexOf("(");

            if (l > -1)
            {
                content = content.Substring(l + 1);
            }
            if (content.EndsWith(")"))
            {
                content = content.Remove(content.Length - 1, 1);
            }
            try
            {
                Newtonsoft.Json.Linq.JObject obj = Newtonsoft.Json.Linq.JObject.Parse(content);
                Newtonsoft.Json.Linq.JToken  objValue;
                if (obj.TryGetValue("status", out objValue))
                {
                    return(null);
                }

                string lng = obj["detail"]["pointx"].ToString();
                string lat = obj["detail"]["pointy"].ToString();

                return(new string[] { lat, lng });
            }
            catch
            {
                return(null);
            }
        }