note 94405 deleted from function.curl-setopt by datibbaw

From: Date: Tue, 18 Mar 2014 02:36:39 +0000
Subject: note 94405 deleted from function.curl-setopt by datibbaw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198946@lists.php.net to get a copy of this message
Note Submitter: php dot net at NO dot sgerrand dot SPAM dot com ---- If you change the post array to a string, PHP creates the post data successfully. As a quick and dirty example of implementing this fix: <?php $ch = curl_init; $url = 'http://www.example.com'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); foreach ($postData as $var) if (strpos($var, '@') === 0) { $postAsString = true; } if ($postAsString === true) { $str = ''; foreach ($postData as $key => $val) { $str .= '&' . $key . '=' . $val; } $postData = substr_replace($str, '', 0, 1); } curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_exec($ch); ?>

« previous php.notes (#198946) next »