473,385 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Screen scraping question

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
2 1503
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Roland Hall | last post by:
Am I correct in assuming screen scraping is just the response text sent to the browser? If so, would that mean that this could not be screen scraped? function moi() { var tag = '<a href='; var...
3
by: Jim Giblin | last post by:
I need to scrape specific information from another website, specifically the prices of precious metals from several different vendors. While I will credit the vendors as the data source, I do not...
1
by: niv | last post by:
Hello, I would like to screen scrape certain parts of a webpage...how can I do this in asp.net For instance.... a stockticker thats embeded on a webpage.. I dont want the entire page.. I...
4
by: rachel | last post by:
Hello, I am currently contracted out by a real estate agent. He has a page that he has created himself that has a list of homes.. their images and data in html format. He wants me to take...
4
by: different.engine | last post by:
Folks: I am screen scraping a large volume of data from Yahoo Finance each evening, and parsing with Beautiful Soup. I was wondering if anyone could give me some pointers on how to make it...
3
by: WFDGW2 | last post by:
I want to write or obtain C++ code that will scrape text from a dialog box within a poker client, and then record that text somewhere else. What do I do? Thanks.
4
by: jeffbg123 | last post by:
Hey, I am trying to make a bot for a flash game using python. However I am having some trouble with a screen scraping strategy. Is there an accepted way to compare a full screenshot with the...
3
by: bruce | last post by:
Hi... got a short test app that i'm playing with. the goal is to get data off the page in question. basically, i should be able to get a list of "tr" nodes, and then to iterate/parse them....
1
by: bruce | last post by:
Hi Paul... Thanks for the reply. Came to the same conclusion a few minutes before I saw your email. Another question: tr=d.xpath(foo) gets me an array of nodes.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.