Login
С/C++ HTTP request, хотя бы простой запрос!
2590 просмотров
Перейти к просмотру всей ветки
in Antwort Bigfan 07.12.10 16:27
это чтоли?
// Open a connection
System.Net.HttpWebRequest _HttpWebRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(_URL);
_HttpWebRequest.AllowWriteStreamBuffering = true;
// You can also specify additional header values like the user agent or the referer: (Optional)
_HttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
_HttpWebRequest.Referer = "http://www.google.com/";
// set timeout for 20 seconds (Optional)
_HttpWebRequest.Timeout = 20000;
// Request response:
System.Net.WebResponse _WebResponse = _HttpWebRequest.GetResponse();
// Open data stream:
System.IO.Stream _WebStream = _WebResponse.GetResponseStream();
// convert webstream to image
_tmpImage = Image.FromStream(_WebStream);
// Cleanup
_WebResponse.Close();
_WebResponse.Close();
Фашизм будет разбит
Человека карают только те боги, в которых он верит