WP调用api

2020-12-13 02:04

阅读:624

标签: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,搜素材,soscw.com

WP调用api

标签:c   code   http   ext   a   get   

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


评论


亲,登录后才可以留言!