cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Help: cURL download

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 8 Nov 2003 14:27:56 +0100 (CET)

On Sat, 8 Nov 2003, Karthik wrote:

> we are trying to download a file using cURL.
> We are facing few problems.
>
> There is a php file which returns a zip file.

It doesn't matter how the server end is implemented.

> We are calling the php page from c++

You are "calling the php page"?

You don't call php pages, but I gues you mean that you request the remote page
using a C++ program and that the remote server runs PHP to provide the
response?

> The same php file is returning a blank file.(We are able to recieve the
> header info. but not the contents).

Uh, so if the PHP doesn't work, how can libcurl get the file properly?

> If we use the following code in php
>
> $fp=fopen($filename, "r");
> fpassthru($fp); or readfile( $filename );

I know next to nothing about PHP, this might be fine.

> cURL works fine.

Yes?

> We are using the following code to return a file
>
> header("Location: ".$file_name);

Uh? That seems to return a location: header to the client, it doesn't send any
file at all.

> we called the same page from IE it works fine but not in cURL.

Again, you don't call pages from IE either.

And what did you do with curl you said?

> This doesn't work.

I don't follow you at all.

> Pls give us a solution

To what problem? Can you please tell me what you do with libcurl, what you
think the program should do, what it does and preferably show us what the
server returns when it fails and what you thought it would have returned.

Also, you might enjoy reading this tutorial before you proceed:

        http://curl.haxx.se/libcurl/c/the-guide.html

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
 [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
Received on 2003-11-08