sads
asked on
Using WebRequest to post data after page found.
Hi
I'm trying to access (screen scrape) a secure web page (have that working) that contains some radio button options. Problem is how do I post and trigger the radio button after I pull the HTML from the secure site?
Here's the code and the output so far:
String MyURI = "https://mySite.com/cgi-bin/orders/textedit.pl";
WebRequest WReq = WebRequest.Create(MyURI);
NetworkCredential cred = new NetworkCredential("id", "pass");
WReq.Credentials = cred;
Stream objStream;
objStream = WReq.GetResponse().GetResp onseStream ();
StreamReader objReader = new StreamReader(objStream);
string sLine = "";
int i = 0;
while (sLine!=null) {
i++;
sLine = objReader.ReadLine();
if (sLine!=null)
Console.WriteLine("{0}:{1} ",i,sLine) ;
}
objReader.Close();
objStream.Close();
WReq.GetResponse().Close() ;
I get the following back:
<html><head></head><body>
2:<form action=/cgi-bin/orders/tex tedit.pl METHOD=POST>
3:<input type=radio name=file value="check-form-log.txt" >check-for m-log.txt< br>
4:<input type=radio name=file value="booking-form-log.tx t">booking -form-log. txt<br>
5:<input type=radio name=file value="contactus-form-log. txt">conta ctus-form- log.txt<br >
6:<input type=radio name=file value="contest-form-log.cs v">contest -form-log. csv<br>
7:<input type=radio name=file value="contest-form-log.tx t">contest -form-log. txt<br>
8:<input type=radio name=file value="feedback-form-log.t xt">feedba ck-form-lo g.txt<br>
9:<input type=radio name=file value="submitlink-log.txt" >submitlin k-log.txt< br>
10:<input type=radio name=file value=".htaccess">.htacces s<br>
11:<input type=submit></form>
12:</body></html>
So at this point what do I post/submit and how do I set up WebRequest to do it?
Any pointers would really be appreciated.
Thanks
Chris
I'm trying to access (screen scrape) a secure web page (have that working) that contains some radio button options. Problem is how do I post and trigger the radio button after I pull the HTML from the secure site?
Here's the code and the output so far:
String MyURI = "https://mySite.com/cgi-bin/orders/textedit.pl";
WebRequest WReq = WebRequest.Create(MyURI);
NetworkCredential cred = new NetworkCredential("id", "pass");
WReq.Credentials = cred;
Stream objStream;
objStream = WReq.GetResponse().GetResp
StreamReader objReader = new StreamReader(objStream);
string sLine = "";
int i = 0;
while (sLine!=null) {
i++;
sLine = objReader.ReadLine();
if (sLine!=null)
Console.WriteLine("{0}:{1}
}
objReader.Close();
objStream.Close();
WReq.GetResponse().Close()
I get the following back:
<html><head></head><body>
2:<form action=/cgi-bin/orders/tex
3:<input type=radio name=file value="check-form-log.txt"
4:<input type=radio name=file value="booking-form-log.tx
5:<input type=radio name=file value="contactus-form-log.
6:<input type=radio name=file value="contest-form-log.cs
7:<input type=radio name=file value="contest-form-log.tx
8:<input type=radio name=file value="feedback-form-log.t
9:<input type=radio name=file value="submitlink-log.txt"
10:<input type=radio name=file value=".htaccess">.htacces
11:<input type=submit></form>
12:</body></html>
So at this point what do I post/submit and how do I set up WebRequest to do it?
Any pointers would really be appreciated.
Thanks
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Greg