码迷,mamicode.com
首页 > Windows程序 > 详细

WP调用api

时间:2014-05-29 00:23:15      阅读:373      评论:0      收藏:0      [点我收藏+]

标签:c   code   http   ext   a   get   

private string GetText()
        {
            string resultString = string.Empty;
            HttpWebRequest request =            HttpWebRequest.CreateHttp("http://www.baidu.com");
            request.Method = "GET";
            request.BeginGetResponse((IAsyncResult result) =>
                {
                    HttpWebRequest webRequest = result.AsyncState as HttpWebRequest;
                    HttpWebResponse webResponse = (HttpWebResponse)webRequest.EndGetResponse(result);
                    Stream streamResult = webResponse.GetResponseStream();
                    StreamReader reader = new StreamReader(streamResult);

                    //获取的返回值
                    resultString = reader.ReadToEnd();
                    streamResult.Close();
                    reader.Close();
                }, request);

            return resultString;
        }

WP调用api,布布扣,bubuko.com

WP调用api

标签:c   code   http   ext   a   get   

原文地址:http://www.cnblogs.com/liyangLife/p/3754392.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!