how to use curl to download a file

bearophile bearophileHUGS at lycos.com
Wed Nov 2 05:56:26 PDT 2011


Ary Manzana:

> Wrong.
> 
> If you want programmers to use D, give them the solution, now.
> 
> It's not that hard to put a little example at the top of the page 
> showing a basic usage.

That wall of links at the top of the page is useless. I don't want to use that C API. This is how you download a file in Python (urllib2 is fully inside the Python standard library) and save it in a local file:

import urllib2
data = urllib2.urlopen("http://server.com/file.html").read()
open('file.html', 'w').write(data)

I think in Clojure or Rebol (http://en.wikipedia.org/wiki/REBOL ) languages it's even simpler.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list