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

  • 相关阅读:
    CPU 上下文切换是什么
    Linux性能优化实战
    JavaScript 概述
    最全前端资源汇总
    zabbix 源码安装
    单例
    php防止sql注入
    python 多进程读写文件
    python twisted异步将数据导入到数据库中
    scrapy-splash常用设置
  • 原文地址:https://www.cnblogs.com/eebb/p/1161694.html
Copyright © 2011-2022 走看看