zoukankan      html  css  js  c++  java
  • google map

        protected void Button1_Click(object sender, EventArgs e)
        {

            string sHtml = "";
            HttpWebRequest request;
            HttpWebResponse response = null;
            Stream stream;

            request = (HttpWebRequest)WebRequest.Create("http://maps.google.com/maps/geo?q=Brghghghkst+raat+336&output=xml&key=ABQIAAAAuaqmm8dDnhww8URMYtFCwhQpDmmpk8q921mRIPG4qgOvy0T09hSxaQUI-wgAo7USMOwfIrceghhDnA");
            response = (HttpWebResponse)request.GetResponse();
            stream = response.GetResponseStream();
            sHtml = new StreamReader(stream, System.Text.Encoding.Default).ReadToEnd();
            stream.Close();
            response.Close();

            int startPosition = sHtml.IndexOf("<coordinates>");
            int endPosition = sHtml.IndexOf("</coordinates>");
            if (startPosition >= 0 && endPosition >= 0)
            {
                string coordi = sHtml.Substring(startPosition, endPosition - startPosition);
                //Label2.Text = coordi;
                int douposition = coordi.LastIndexOf(",");
                coordi = coordi.Substring(0, douposition);
                Label1.Text = coordi;
            }
            else
            {
                Label1.Text = "no";
            }
        }

  • 相关阅读:
    多线程GCD
    根据UITouch 自定义手势
    KVC在数据解析中的应用
    oc 文件读写操作
    oc 字典应用实例-城市查询省份
    oc 字典应用实例-成绩科目排序
    oc 数组应用实例-验证码
    协议 protocol
    概念杂记
    OC 类的继承 方法重载重写
  • 原文地址:https://www.cnblogs.com/eebb/p/1161694.html
Copyright © 2011-2022 走看看