By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,973 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,973 IT Pros & Developers. It's quick & easy.

Screen scraping question

P: n/a
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

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


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

-- bruce (sqlwork.com)
"Victor" <Vi****@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
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

Nov 19 '05 #2

P: n/a
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" wrote:
you have to look at the javascript source and see what it does, then
duplicate the logic in your code.

-- bruce (sqlwork.com)
"Victor" <Vi****@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
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


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.