I am trying to post the an xml string using curl.
Here is the code
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 120);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($curl, CURLOPT_ENCODING, 'utf-8');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'SOAPAction:""',
'Content-Type: text/xml; charset=utf-8',
));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($curl, CURLOPT_SSLCERT, '.............');
curl_setopt($curl, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($curl, CURLOPT_SSLKEY, '.............');
curl_setopt($curl, CURLOPT_SSLKEYPASSWD, '');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlData);
curl_setopt($curl, CURLOPT_HEADERFUNCTION, 'read_header'); // get header
$result = curl_exec($curl);
This is the result I keep on getting
Resource id #4
I'm new to curl but I'm trying to study it. Is that the right code in my curl php?
I expect this sample response from curl:
{"status_code":"....","message":"..........."}