当前位置:起点学习辅导网培训频道电脑知识学习网页制作移动WAP开发用C#读取sina天气预报到wap页面

用C#读取sina天气预报到wap页面

08-08 00:46:21浏览次数:806栏目:移动WAP开发
标签:移动WAP开发教程,wap网站开发,wap开发教程, 用C#读取sina天气预报到wap页面,
            //将URL编码后的字符串转化为字节
            request.ContentLength = payload.Length; //设置请求的ContentLength
            Stream writer = request.GetRequestStream(); //获得请求流
            writer.Write(payload,0,payload.Length); //将请求参数写入流
            writer.Close(); //关闭请求流
            HttpWebResponse response;
            response = (HttpWebResponse)request.GetResponse(); //获得响应流
            Stream s;
            s = response.GetResponseStream();
            StreamReader objReader = new
            StreamReader(s,System.Text.Encoding.GetEncoding("GB2312"));
            string HTML = "";
            string sLine = "";
            int i = 0;
            while (sLine!=null)
            ...{
            i++;
            sLine = objReader.ReadLine();
            if (sLine!=null)
            HTML += sLine;
            }
            HTML = HTML.Replace("<","<");
            HTML = HTML.Replace(">",">");
            int start,stop;
            start = HTML.IndexOf("<img
            src="http://image2.sina.com.cn/dy/weather/images/figure/",0,HTML.Length);
            stop = HTML.IndexOf("<td
            background=http://image2.sina.com.cn/dy/weather/images",start);
            temp = HTML.Substring(start, stop - start);
            }
            catch (Exception x)
            ...{
            }
            return temp;
            }
            }

上一页  [1] [2] [3] [4] 

,用C#读取sina天气预报到wap页面
《用C#读取sina天气预报到wap页面》相关文章
给资讯打分:
网友评论: