Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > command for downloading a remote file?

command for downloading a remote file?
Thread Tools
Mac Enthusiast
Join Date: Dec 2002
Location: Newport Beach, CA
Status: Offline
Reply With Quote
Feb 25, 2004, 02:26 PM
 
what command should I use for retreiving a remote file that is a web link?

the address would be something like http://www.someplace.com/somefile.iso

I am logged into my machine using ssh, and I want to tell it to go get this file...

TIA

Be a traveler, not a tourist
     
Mac Elite
Join Date: Nov 2003
Location: Minnesota
Status: Offline
Reply With Quote
Feb 25, 2004, 02:30 PM
 
Most machines use wget, but I believe that OS X only has curl. Try `curl http://www.someplace.com/somefile.iso > somefile.iso'
     
EnVoy  (op)
Mac Enthusiast
Join Date: Dec 2002
Location: Newport Beach, CA
Status: Offline
Reply With Quote
Feb 25, 2004, 02:43 PM
 
I get this error:

xxxx:~/Desktop] xxxx% curl -v http://xxxxx/xxxxx/xxxx/xxxxx/xxxxxx.iso
* Closing live connection (#0)
curl: (7) Connection refused
xxxx:~/Desktop] xxxx%


Does this mean the remote server is refusing curl requests or something?

Be a traveler, not a tourist
     
JNI
Forum Regular
Join Date: Oct 2002
Location: Left Coast
Status: Offline
Reply With Quote
Feb 25, 2004, 03:35 PM
 
Originally posted by EnVoy:
I get this error:

xxxx:~/Desktop] xxxx% curl -v http://xxxxx/xxxxx/xxxx/xxxxx/xxxxxx.iso
* Closing live connection (#0)
curl: (7) Connection refused
xxxx:~/Desktop] xxxx%


Does this mean the remote server is refusing curl requests or something?
curl just initiates an HTTP request (or FTP or whatever the URL specifies.) An HTTP request is really just a TCP/IP message, so the site shouldn't care if the request came from curl or any other tool. Think of curl as just like a browser that sends a request and then displays the result in some way. (curl just directs the result to either standard out or a file as opposed to rendering it in a GUI browser)

Some sites do require more than just a raw HTTP request. E.g. some sites look at the 'user-agent' sent with the request. That is why some sites only work with IE and others don't. One thing I've found is that sometimes you have to add the -A option to curl specifying something like 'Mozilla/4.0' to get the site to send the response. Also some times you need to supply cookies to the server before it will accept the request (again, that can be done on the curl command line, but is a bit more difficult to construct.)

The error you show seems like there is some kind of authentication requirement missing. Does the site require cookies, or maybe a name/password? You would have to add those to the curl command line. I don't know exactly how you would determine what the site is requiring.
     
EnVoy  (op)
Mac Enthusiast
Join Date: Dec 2002
Location: Newport Beach, CA
Status: Offline
Reply With Quote
Feb 25, 2004, 07:24 PM
 
No password/user needed, just a straight http link.

Interesting thing is I ran the exact same command, letter for letter, on my Linux machine and the download initiated fine.

Be a traveler, not a tourist
     
JNI
Forum Regular
Join Date: Oct 2002
Location: Left Coast
Status: Offline
Reply With Quote
Feb 25, 2004, 08:21 PM
 
Originally posted by EnVoy:
No password/user needed, just a straight http link.

Interesting thing is I ran the exact same command, letter for letter, on my Linux machine and the download initiated fine.
Well, that doesn't make any real sense then. curl works fine for me in OS X - I use it all the time to grab web pages and stuff, either directly from the command line, in cron jobs or from within wrapper applications.

I don't know what your problem could be. Maybe some firewall setting on your OS X machine? Or some kind of network timeouts only affecting your OS X machine. Or something installed badly on your system. (have you been playing with fink or something?)

Can you curl from any other site, or is it only that particular one? You should be able to grab anything at a valid URL, like the home page from www.apple.com or whatever.
     
EnVoy  (op)
Mac Enthusiast
Join Date: Dec 2002
Location: Newport Beach, CA
Status: Offline
Reply With Quote
Feb 25, 2004, 08:23 PM
 
OK figured it out. My bad When I was able to sit down infront of the machine I saw that Little Snitch was blocking the curl outbound. Works fine now, thanks for the help.

Be a traveler, not a tourist
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:56 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2