c# get dynamic webpage data

  • Thread starter Thread starter petersonal
  • Start date Start date
P

petersonal

Guest
Dear all!

I'm new to programing. I am trying to get data from a webpage. Example: I tring to get if an IP is listed at a blacklist, the webpage takes time to search or fully load the page, and even when it does, the source code does not have the information what i 'd like to obtain, like the IP is on the blacklist. Any help would be welcome

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("Network Tools: DNS,IP,Email");
//set big timeout 30 sec
request.Timeout = 30 * 1000;
// put result to a textbox to see
string postData = textBox1.Text;

request.Method = "Post"; // we will post the data using post method

// data to be posted using HttpWebrequest post method
string postData = textBox1.Text;
// Convert this string into stream of bytes
byte[] arrPostDAta = System.Text.Encoding.GetEncoding(1252).GetBytes(postData);
// set request content length = post data length
request.ContentLength = arrPostDAta.Length;
// get request stream
System.IO.Stream strmPostData = request.GetRequestStream();

// write post data to stream of request
strmPostData.Write(arrPostDAta, 0, arrPostDAta.Length);

strmPostData.Close();

// upload post data and Get Response from server

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

StreamReader reader = new StreamReader(response.GetResponseStream());
textBox1.Text = reader.ReadToEnd();

reader.Close();

response.Close();

Continue reading...
 
Back
Top