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";
            }
        }

  • 相关阅读:
    C++ Primer学习笔记(三) C++中函数是一种类型!!!
    C++类的成员函数的形参列表后面的const
    C++ const总结
    简单的使用Gson (序列化 和 反序化)
    HTML 获取class里的多个值 和 dataset的使用
    SiteMesh的简单使用
    IDEA 使用LiveEdit插件
    Java 转发和重定向的区别
    Web.xml 定制URL
    java 枚举类(简单使用)
  • 原文地址:https://www.cnblogs.com/eebb/p/1161694.html
Copyright © 2011-2022 走看看