Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in D:\InetPub\vhosts\kwu-1639.package\kennywu.info\wwwroot\wp-content\plugins\wp-syntax\wp-syntax.php on line 380
HttpWebRequest and HttpWebResponse greatly simplified http content retrial process. Code snippet below demonstrated how easy to use.
using System; using System.Text; using System.Net; using System.IO; static void Main(string[] args) { string webUrl = "http://www.google.com"; WebRequest req = WebRequest.Create(webUrl); req.Timeout = 10000; WebResponse resp = req.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream(), Encoding.ASCII); Console.WriteLine(reader.ReadToEnd()); resp.Close(); // Close the response to free resources. reader.Close(); } |
Simple and elegant. To look for more…Retrieving HTTP content in .NET