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

curl-and-php

Need help with POST field values that start with '@'

From: Kelvin Lim <milnivlek_at_gmail.com>
Date: Mon, 23 Apr 2007 20:41:10 +0800

Hi,

How can I use PHP/CURL to send a POST form submission that has both a file
upload *and* a text field that can potentially take values starting with
'@'?

I know I can get file uploads working if I call curl_setopt() with an array
value for CURLOPT_POSTFIELDS (e.g. array('upload' => '@filename.ext')). And
I know I can submit text field values starting with '@' if I call
curl_setopt() with a string value for CURL_POSTFIELDS (e.g.
'foo=@myValue&bar=value2'. But I can't for the life of me figure how how to
do *both* with the same POST request using the available API.

I'm working on a program that interfaces with legacy web applications, and
unfortunately changing the submission data format of the legacy apps is not
an option. I'd really appreciate any tips at all for doing what I want.
Even some ugly code hack/workaround would be fine, as long as I can still
use cURL to achieve the desired result somehow.

Thanks a lot.

Kelvin Lim
Software engineer

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-04-23