Dear C Corner
I got a website with a search Box. If i want a program to run like 20 scripts or some word against that search box, what is the c code for such a program?
More simpel:
The hard way would be to type in
Hello
What
No
Yes
You
in the search box.
But i want the code for a program that does all that by itself.
Can you help me?
Loading
PJ MartinsPosted May 25, 2010, 6:32 PM
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("search.com?query=Hello");
request = (HttpWebRequest)WebRequest.Create("search.com?query=What");
Stream requestStream = ((HttpWebResponse)request.GetResponse()).GetResponseStream();
return (new StreamReader(requestStream)).ReadToEnd();
If its via post you'll need to set the request's method to POST, and write the search string to it's stream.
eg.
byte[] buffer = Encoding.ASCII.GetBytes("<
Stream requestStream = request.GetRequestStream();
requestStream.Write(buffer, 0, buffer.Length);
requestStream.Close();
requestStream = ((HttpWebResponse)request.GetResponse()).GetResponseStream();
return (new StreamReader(requestStream)).ReadToEnd();