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

curl-and-php

Re: multipart/form-data POST problem with php 4.0.6

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 3 Nov 2001 09:28:50 +0100 (MET)

On Fri, 2 Nov 2001, Axel Suppantschitsch wrote:

> I'm initializing curl with following switches:
>
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $post_url);
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_VERBOSE, 0);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
>
> $postfields is an array, $post_url contains the https://***.cgi link.
>
> Though I set CURLOPT_POST to 1, it still uses multipart/form-data.

You're talking about the CURL module in PHP, which was written by Sterling
Hughes, but I had a dive into that code and yes, I can confirm what you're
saying:

If you pass an array to CURLOPT_POSTFIELDS, that's what it'll do. Pass a
string instead to make it do the POST you want.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-11-03