
On Mon, Apr 16, 2012 at 4:40 PM, Isaac Kimotho <izakimotho@gmail.com> wrote:
I have tried to send data in php with a Plus (+) sign. When i send the data using a $_post it replaces Plus(+) with a space how can i make this work
sample script
$url = "http://www.samplesite.ke/receive.php"; $account=123; $values="this is blood group B+ with rhesus factor"; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $account); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"account=". $account."&val=".$values. "); $result= curl_exec ($ch); curl_close ($ch);
the result recieved is
this is blood group B with rhesus factor
You may want to URL encode [1] the data before sending it. Probably using the urlencode function: <http://php.net/manual/en/function.urlencode.php>. As a bonus, you can also use this service for debugging: <http://httpbin.org/>. [1] <http://en.wikipedia.org/wiki/Percent-encoding> Joseph.