+ being converted to space when sending POST data with CURL
Posted: Mon Oct 10, 2005 3:46 pm
Code: Select all
<?php
$URL="secure.comodo.net/products/!DecodeCSR";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://$URL");
curl_setopt($ch, CURLOPT_POST, 1);
header('Content-type: text/plain;');
curl_setopt($ch, CURLOPT_POSTFIELDS, "csr=".$_POST['csr']."&showcsr=Y");
$response = nl2br(curl_exec ($ch));
curl_close ($ch);
?>showcsr=Y shows the CSR input again....and it always converts +s into spaces...
this is a problem because CSRs have +s in them...and when they are converted into spaces the CSR cannot be decoded.
here is a sample CSR that SHOULD be validated (but is not due to the +s being changed to spaces)
Does anyone know why this is happening? I suspect it may have something to do with the content-type...but it's hard to say.-----BEGIN CERTIFICATE REQUEST-----
MIIBzTCCATYCAQAwgYwxCzAJBgNVBAYTAmdiMQ8wDQYDVQQIEwZMb25kb24xDzAN
BgNVBAcTBkxvbmRvbjEZMBcGA1UEChMQU3BhY2VTdXJmZXIgTHRkLjEZMBcGA1UE
AxMQd3d3LnNwYWNlcmVnLmNvbTElMCMGCSqGSIb3DQEJARYWd2VibWFzdGVyQHNw
YWNlcmVnLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAywfuXnd348ot
iAcZ4RHFc509ImCTagKaNkiQ4xyijbPYP7H0UQ5iXqvojSIcbUOVhExqwqyqjCPm
7ZpON3IXktIcKAwPFvoqKkHuqTa8KMnZTSY8P7QILYHFd2Sd1l1arCrWv8HWb+qM
RHVTlviBaLAHQxnz28qKkYN09K0fw5cCAwEAAaAAMA0GCSqGSIb3DQEBBAUAA4GB
AFMgp2KkHQXMC1JbZf3AkIz7mrl4X21cRusTfd8ec3RuMZexGy76jMGFyPWVM69R
Fvpfiic8h28HrHube7pEPFpdUSj2cR4OZCAg5uqzN/ESwc4CtLzej7pWoDPpc/kv
hiJ/eGOxINKd39kCuzIS6zrvb2ihJth7jcmokezmrwjQ
-----END CERTIFICATE REQUEST-----
Thanks in advance for any help, it is greatly appreciated.