Curl to download a file from website

Hello
I have file that I need to download for reports to turn in.
How can I use curl or wget to download the file that I have to click on the "download" button?

Below is a wget from the  HTML page that shows the "download" button in code.

<p>File is too large to display (36247KB).  To view the file, download it to a local hard drive and open it in a text editor.</p>
<table>
<form action='/cgi-bin/repot.cgi/da/reporting_mail_detailed.html'>
<input type='hidden' name='pr_op' value='dump'>
<input type='hidden' name='sessionid' value='AAaaaasdsds'>
<input type='hidden' name='repo_yearday' value='2011-350'>

<tr><td>
<font class=text1>&nbsp;<input type='submit' name='exportnow' value='Download' class='btn'></font>
</td></tr>
</form>

Open in new window

LVL 1
mechanicus01Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arober11Commented:
If your using:

Firefox, download and install the LiveHTTPHeader plug-in, enable from the Tools menu and download the file, then have a look in the log for the files URL.

Chrome - Press F12 on the page and select the "Network" tab, and download the tile.
0
mechanicus01Author Commented:
Ok, I'm on Chrome > Network and the request method is GET but I don't see how to download the file.
Plus , I would like to use some CLI method because I need to script the download.
0
mechanicus01Author Commented:
Unless there is a different way to download the file from a Unix script
0
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

arober11Commented:
When you download the File (click the "save as"), a header / network object should appear in the history with the absolute URL to the file. Cut'n'paste this into your curl script.
0
mechanicus01Author Commented:
Didn't work for me. Do you have a screenshot of what I should be looking for?
0
mechanicus01Author Commented:
Any news?
0
Ray PaseurCommented:
I got a neglected question alert on this.  Have you tried just clicking the Download button?  It looks like it might take a while over HTTP if you have to download 35 megabytes, but my sense is that you want to ride this horse in the direction it is already going.
0
mechanicus01Author Commented:
Of course I've tried to click the download button via the GUI but that is not what I need.
I need to download the file through a wget, cURL, or other.
0
Ray PaseurCommented:
What programming languages do you have available to you?
0
Ray PaseurCommented:
Also, what is the URL of the page that has the HTML posted above?
0
mechanicus01Author Commented:
Although I am not, I see that you handle php well, so we can try that language.
The URL is a server where the file is is in a LAN so your can't get to it. What exactly do you need to know?
0
mechanicus01Author Commented:
What I am trying to do is script the download using AppleScript or a Shell script then schedule a cron job to download it at 10 mins past midnight.
0
mechanicus01Author Commented:
Ok, I found the answer at http://curl.haxx.se/docs/httpscripting.html


4.1 GET
 
  A GET-form uses the method GET, as specified in HTML like:
 
        <form method="GET" action="junk.cgi">
          <input type=text name="birthyear">
          <input type=submit name=press value="OK">
        </form>
 
  In your favorite browser, this form will appear with a text box to fill in
  and a press-button labeled "OK". If you fill in '1905' and press the OK
  button, your browser will then create a new URL to get for you. The URL will
  get "junk.cgi?birthyear=1905&press=OK" appended to the path part of the
  previous URL.
 
  If the original form was seen on the page "www.hotmail.com/when/birth.html",
  the second page you'll get will become
  "www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK".
 
  Most search engines work this way.
 
  To make curl do the GET form post for you, just enter the expected created
  URL:
 
        curl "http://www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK"
 

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mechanicus01Author Commented:
First time I answer my question here at EE :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.