Java script and screen scraping

G

Guest

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
 
B

Bruce Barker

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)
 
G

Guest

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 said:
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 said:
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
 

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

Top