cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Download a file from an https site.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 28 Oct 2002 17:32:33 +0100 (MET)

On Thu, 24 Oct 2002, Fluteau Jerome ICM N PG U PLM A 2 wrote:

> Basically when we use IE, we click on the URL, and then Windows asks us
> where we want to store this file on our hard disk. I'd like to do the same
> thing but automaticaly in a PHP script using Curl.
>
> How can I trigger the file downloading and store it exactly where I want on
> my disk?

1. Install the CURL module with your PHP.

2. Write your CURL-using program. A few keywords:

  curl_init("https://...")

  curl_setopt(... CURLOPT_FILE)

  curl_exec()

  curl_close()

3. Enjoy your downloaded file.

Or, if you can't install the curl module, use the curl command line tool from
within your script.

Ah, and try the docs:

        http://www.php.net/manual/en/ref.curl.php

and for the CURLOPT_ ones, try this:

        http://curl.haxx.se/libcurl/c/curl_easy_setopt.html

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-28