curl-and-php
Re: multipart/form-data posts
Date: Mon, 1 Oct 2001 07:54:58 +0200 (MET DST)
On Fri, 28 Sep 2001, Pete James wrote:
> Now I need to re-send the form to the backend page for processing. How
> do I fake a multipart/form-data post in php?? What I've already learned:
> CURLOPT_HTTPPOST would seem to be an answer, but it seems unsupported in
> php;
CURLOPT_HTTPPOST is indeed used for multipart/form-data posts. The hard thing
is to setup the linked list properly, which in libcurl used to be done with
curl_formparse() which since 7.9 is being replaced with curl_formadd(). None
of those functions seem to exist in the PHP interface...!
> using CURLOPT_POSTFIELDS with name=@filename doesn't seem to work...
> perhaps because it's urlencoded.
No, it doesn't work because it sends the data very differently.
> Has nobody ever needed to do this, or am I really missing something??
If nothing else, you can do this using the command line client. I mean,
that's probably not what you want to do but can be a work-around until it
works in PHP...
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2001-10-01