There is a webpage I currently download data feeds from by clicking a button similar to the 'Login' button shown on this link:
.aspx
However this button is simply a 'Download' request that starts downloading a csv report.
Versus manually visiting this page to download fresh data, I am attempting to automate the process of downloading the report to feed into my scripts, however I am unable to figure out how to determine what the link is for this 'get' request, or how to download the file directly with a wget (That is, what is the source behind the button?)
How would I go about finding out this information?
I have looked through the page source and can't find any clues on this.
There is a webpage I currently download data feeds from by clicking a button similar to the 'Login' button shown on this link:
http://www.cebumode./AMWEBLOGIN.aspx
However this button is simply a 'Download' request that starts downloading a csv report.
Versus manually visiting this page to download fresh data, I am attempting to automate the process of downloading the report to feed into my scripts, however I am unable to figure out how to determine what the link is for this 'get' request, or how to download the file directly with a wget (That is, what is the source behind the button?)
How would I go about finding out this information?
I have looked through the page source and can't find any clues on this.
Share Improve this question asked Jul 15, 2014 at 11:40 Ben C WangBen C Wang 61711 silver badges20 bronze badges 3- It'll be done server side, so there won't be anything in the source telling you what to do – Andy Holmes Commented Jul 15, 2014 at 11:42
- So if that is the case, it looks like I will need to contact the webmaster for this information. – Ben C Wang Commented Jul 15, 2014 at 11:43
- @AndyHolmes That's not entirely true, you just need to manually construct the request packet from the form elements, which is not something that most people remend. – RevanProdigalKnight Commented Jul 15, 2014 at 11:44
1 Answer
Reset to default 4The relevant bits on your page is this:
<form method="post" action="AMWEBLOGIN.aspx" id="form1">
<input name="txtUsername" type="text" id="txtUsername" style="border-width:1px;border-style:Solid;font-family:Calibri;font-size:14pt;width:250px;" autoplete="off">
<input name="txtPassword" type="password" id="txtPassword" style="border-width:1px;border-style:Solid;font-family:Calibri;font-size:14pt;width:250px;">
<input type="submit" name="btnLogin" value="Login" id="btnLogin" style="font-family:Calibri;font-size:14pt;">
</form>
It makes a HTTP-Post request to http://www.cebumode./AMWEBLOGIN.aspx with variables txtUsername and txtPassword.
This is pretty scary by the way, as it transmits the username & password in plain-text, and probably receives the forms authentication cookie unencrypted as well.
So the wget mand line is something like this:
wget --post-data "txtUsername=$USERNAME&txtPassword=$PASSWORD" --save-cookies cookies.txt --user-agent=Mozilla/5.0 http://www.cebumode./AMWEBLOGIN.aspx
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745292618a4620951.html
评论列表(0条)