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

curl-and-php

RE: Download a file from an https site.

From: Fluteau Jerome ICM N PG U PLM A 2 <jerome.fluteau_at_siemens.com>
Date: Wed, 30 Oct 2002 14:48:44 +0100

Hi,

I still don't know why I have this problem, I read that it could be a RAM
problem or maybe Apache is using the
dll from a previous install...
Anyway I'm gonna try with the curl command line tool. After installing it, I
tried this command in MSDOS:

curl https://my-server.com

and it worked, I got the HTML code of this page.
Now how can I do the same thing within PHP? Using this:

exec("curl "https://my-server.com"");

but then how can I get the HTML code as in the command line?

Thanks.

-----Original Message-----
From: Fluteau Jerome ICM N PG U PLM A 2
Sent: Tuesday, October 29, 2002 3:14 PM
To: 'curl-and-php_at_lists.sourceforge.net'
Subject: RE: Download a file from an https site.

I tried curl_setopt(... CURLOPT_FILE) but there is a problem with Apache.
When I use it,
Apache sends me an Application error:

"The instruction at "0x77..." referenced memory at "0x00...". The memory
could not be "written"".

Although when I remove it, I get my file into IE as previously. But the
problem remains...:-)
The problem is that Apache doesn't allow me to write in my htdocs folder I
think.
But there is no rights working on my PC, I don't see the problem, maybe I
forgot something in httpd file...

Sorry it is surely not the right place for this Apache problem, but maybe
someone has an idea...

Regards.

-----Original Message-----
From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: Monday, October 28, 2002 5:33 PM
To: curl and php list
Subject: Re: Download a file from an https site.

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
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-30