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

Java script and screen scraping

P: n/a
Hi,

I have a problem with logging into web site via screen scraping. User name
and password field contain 'name' property, and therefore I can easily do
assignment 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>

Java 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>

How can I refer to it or invoke it?

Following is my c# code:
byte[] _bParameters = null;
byte[] _bResponse = null;
string _response = "";
pParameters = "userid=uidTest&password=pwTest"; // how to assign or execute
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 need to look inside the <form name=login> tags to see all the required
field names. then you post to the
"/servlet/com.main.tmt.servlets.TmtLoginServlet" url. you will have to check
the cookies coming back for the login cookie.

-- bruce (sqlwork.com)
"Victor" <Vi****@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
Hi,

I have a problem with logging into web site via screen scraping. User name
and password field contain 'name' property, and therefore I can easily do
assignment 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>

Java 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>

How can I refer to it or invoke it?

Following is my c# code:
byte[] _bParameters = null;
byte[] _bResponse = null;
string _response = "";
pParameters = "userid=uidTest&password=pwTest"; // how to assign or
execute
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
Thank you for ypur response.

My URL is https://test.pls.com/login.jsp/

So, if I understood you correctly I should POST to https://test.pls.com
/login.jsp/servlet/com.main.tmt.servlets.TmtLoginServlet
with required field names such as user name and password.

Thanks again,
Victor
"Bruce Barker" wrote:
you need to look inside the <form name=login> tags to see all the required
field names. then you post to the
"/servlet/com.main.tmt.servlets.TmtLoginServlet" url. you will have to check
the cookies coming back for the login cookie.

-- bruce (sqlwork.com)
"Victor" <Vi****@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
Hi,

I have a problem with logging into web site via screen scraping. User name
and password field contain 'name' property, and therefore I can easily do
assignment 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>

Java 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>

How can I refer to it or invoke it?

Following is my c# code:
byte[] _bParameters = null;
byte[] _bResponse = null;
string _response = "";
pParameters = "userid=uidTest&password=pwTest"; // how to assign or
execute
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.