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

curl-and-php

Re: curl Upload: command line OK - libcurl/PHP problem!

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 3 Apr 2004 15:29:12 +0200 (CEST)

On Fri, 2 Apr 2004, Harry Fearnley wrote:

> I used to believe that there was nothing "magical" about hash arrays here,
> and that whatever was passed as a hash array could alternatively be passed
> as text ...
>
> My understanding was that these two methods were equivalent:
>
> A) curl_setopt($ch, CURLOPT_POSTFIELDS, "a=A&b=B");
>
> B) $pf = array ('a' => 'A', 'b' => 'B')'
> curl_setopt($ch, CURLOPT_POSTFIELDS, $pf)

They're not. Case A makes a normal POST, case B makes a multipart post.

> I will try (a modification) of this code, and report my results, though I
> cannot pretend to understand how it might work for a file upload to a server
> other than the one that I am running the PHP script on ... :-)

The upload is made to the server you specify in the URL.

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-03