Screen scraping question

G

Guest

I'm doing screen scraping by retrieving data from one site and entering into
another site.
I have a problem with logging into the site. User name and password field
contain 'name' property, and therefore I can easily do assign statement to
them.
"userid=uidTest&password=pwTest"

However, submit button represented on page via hyper link:
<A href="javascript:login()" onBlur ="foc()"><IMG align=middle border=0
height=15 src="images/submit.gif" width=64></A>

How can I refer to it? And what should I assign to it in my code?

Following is my c# code:
byte[] _bParameters = null;
byte[] _bResponse = null;
string _response = "";
pParameters = "userid=uidTest&password=pwTest"; // how to assign hyperlink?
_bParameters = Encoding.ASCII.GetBytes(pParameters);
_bResponse = _wc.UploadData(pURI, "POST", _bParameters);
_response = System.Text.Encoding.ASCII.GetString(_bResponse);


Thanks,
Victor
 
B

Bruce Barker

you have to look at the javascript source and see what it does, then
duplicate the logic in your code.

-- bruce (sqlwork.com)
 
G

Guest

Bruce,

Thanks for response.
I was trying to figure out what to send in pParameters variable and so far
no luck.

Script looks like this:
<script language=\"JavaScript1.2\">
function login()
{
document.login.method=\"post\";
document.login.action=\"/servlet/com.main.tmt.servlets.TmtLoginServlet\";
document.login.submit();
}
// end function
function foc() {
document.login.userid.focus();
}
</script>

Thanks,
Victor


Bruce Barker said:
you have to look at the javascript source and see what it does, then
duplicate the logic in your code.

-- bruce (sqlwork.com)


Victor said:
I'm doing screen scraping by retrieving data from one site and entering
into
another site.
I have a problem with logging into the site. User name and password field
contain 'name' property, and therefore I can easily do assign statement to
them.
"userid=uidTest&password=pwTest"

However, submit button represented on page via hyper link:
<A href="javascript:login()" onBlur ="foc()"><IMG align=middle border=0
height=15 src="images/submit.gif" width=64></A>

How can I refer to it? And what should I assign to it in my code?

Following is my c# code:
byte[] _bParameters = null;
byte[] _bResponse = null;
string _response = "";
pParameters = "userid=uidTest&password=pwTest"; // how to assign
hyperlink?
_bParameters = Encoding.ASCII.GetBytes(pParameters);
_bResponse = _wc.UploadData(pURI, "POST", _bParameters);
_response = System.Text.Encoding.ASCII.GetString(_bResponse);


Thanks,
Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top