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

curl-and-php

RE: CURL running form PHP exec() problem!

From: Matt Parkins <matt_at_the-parkins.co.uk>
Date: Thu, 7 Apr 2005 08:47:10 +0100

Is the file path URL encoded?

Here's what I do in PHP:

                                // concatenate the submission data and put
into variable $data
                                while(list($key, $value) = each($postdata))
{
                                        $data .= " -F
'$key=".urlencode(ereg_replace(',', '', $value))."' ";
                                }

                                // The commented line below is an alternate
connection method
                                $curlcmd = _CURL_COMMANDLINE." $data
"._BACKOFFICE_ADDRESS."functions/processreturndata.php";
                                ob_start();
                                passthru($curlcmd);
                                $result = ob_get_contents();
                                ob_end_clean();

Matt

-----Original Message-----
From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: 07 April 2005 07:59
To: fluzj_at_21cn.com; Programming PHP/CURL
Subject: Re: CURL running form PHP exec() problem!

On Thu, 7 Apr 2005, James Lu wrote:

> in 3th -F option ,I want to upload the /tmp/upload file,so i used the
> @ sign.when I run it in the command console,anything is OK! But when I
> Call it from PHP's exec(),it do nothing and return value is not 0 but
> 26,when i drop the @ sige ,it can work ,but just the content
> of"/tmp/upload". Idon't know the reason, PHP or Curl problem? thanks

Since you already said it works when you run it from the command line, I
would say that there's some PHP thing causing this. Perhaps you need to
escape the @-letter somehow?

I am rather clueless about PHP.

--
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-04-07