Advertisement
Guest User

Example Pastebin

a guest
Nov 20th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. private void Get_EANInfo(string Str_EAN, string Str_ID)
  2. {
  3.     string Str_LMWURL = ("http://opengtindb.org/?ean=" + Str_EAN + "&cmd=query&queryid=" + Str_ID);
  4.     this.label1.Text = Str_LMWURL; // URL als ganzes
  5.     WebRequest WebRequest_Request = WebRequest.Create(Str_LMWURL);
  6.     WebRequest_Request.Credentials = CredentialCache.DefaultCredentials;
  7.     HttpWebResponse HttpWebResponse_Response = (HttpWebResponse)WebRequest_Request.GetResponse();
  8.     // Ausgabe
  9.     this.richTextBox1.AppendText(HttpWebResponse_Response.StatusDescription + "\r"); //RichtextBox
  10.     // Stream
  11.     Stream Stream_DataStream = HttpWebResponse_Response.GetResponseStream();
  12.     StreamReader StreamReade_Reader = new StreamReader(Stream_DataStream);
  13.     // Read data
  14.     string Str_ResponseFromServer = StreamReade_Reader.ReadToEnd();
  15.     this.richTextBox1.AppendText(Str_ResponseFromServer + "\r"); //RichtextBox
  16.  
  17.     // Close
  18.     StreamReade_Reader.Close();
  19.     Stream_DataStream.Close();
  20.     HttpWebResponse_Response.Close();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement