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

curl-and-php

Re: Problems using PHP CURL option CURLOPT_READFUNCTION

From: Erik Stieringer <erik_at_grossmontdesigns.com>
Date: Fri, 01 Aug 2003 01:39:21 -0700

Don't know if this helps, but here is some code I wrote to receive a file
from a remote FTP server and write the file to my server:

(NOTE: This does not use CURL)

$ftp_server = "PLACE SERVER NAME HERE";
$user = "PLACE USER LOGIN HERE";
$pass = "PLACE USER PASS HERE";

$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $user, $pass);

$changedir = ftp_chdir ($conn_id, "/PLACE REMOTE DIRECTORY HERE");

$get_result=ftp_get($conn_id, "PLACE FULL DIRECTORY PATH ON YOUR SERVER TO
WRITE THE FILE TO HERE/$File", $File, FTP_ASCII);
ftp_quit($conn_id);

on 8/1/03 1:01 AM, Daniel Stenberg at daniel_at_haxx.se wrote:

> On Fri, 1 Aug 2003, Stefan Hadjistoytchev wrote:
>
>> I would like to transfer a file to ftp site using Curl.
>>
>> As stated in the PHP Curl FAQ:
>> ****************************
>> 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
>> Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
>> that DLL use the FILE *. If you set CURLOPT_FILE you must also use
>> CURLOPT_WRITEFUNCTION as well to set a function that writes the file, even
>> if that simply writes the data to the specified FILE*. Similarly, if you
>> use
>> CURLOPT_INFILE you must also specify CURLOPT_READFUNCTION.
>> ****************************
>>
>> I have no idea how the function specified in CURLOPT_READFUNCTION option
>> should look like !?!
>
> I have no idea either. I can see in the PHP/CURL source code that the option
> is supported fine, but I am clueless when it comes to PHP and can't tell you
> how it is supposed to be used.
>
> This is an obvious case when the C interface docs is not sufficiant for
> PHP/CURL users...

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-08-01