I am using this code… but i am getting some curl error in my code..
function send_data($data) {
$url = ""; // URL to POST FORM. (Action of Form)
$url .= '?acx=' . urlencode('V2ViSnNvbkRldkFwbkBTaWdtYUFwbjpXZWIxMjMkSnNvbg==') . '&key=' . urlencode('QW51bWF0aGlVbmRhQFNpZ21hQXBuOlVuZHVBbnVtYXRoaQ==');
$url .= '&impdata=' . urlencode('{"System":{"Client":"SigmaApn","ACX":"V2ViSnNvbkRldkFwbkBTaWdtYUFwbjpXZWIxMjMkSnNvbg==","KEY":"QW51bWF0aGlVbmRhQFNpZ21hQXBuOlVuZHVBbnVtYXRoaQ==","ClientIP":"74.117.104.99","Mode":"TEST"},"Module":{"Process":"BatchEnrollment","Version":"2.1.5","DataDefinition":[{"Name":"enrolment_queue","IncludeRecType":"false","Identifier":"sys_batch_no","Header":["batch_no","source","source_line","agent_code","premise_id","plan_group","request_date","enrol_type","cust_firstname","cust_lastname","phone1","cm_address1","cm_city","cm_state","cm_zip","life_support","cust_status","plan_id1","contract_ind","contract_type","calc_method","rate_type","adder1_rate","cust_bill_type","edi_bill_presenter"]}],"Data":[["Batch","BATCH","1","0","PREMISE1","R","10/28/2011","M","' . $data['personalinfo_first_name'] . '","' . $data['personalinfo_last_name'] . '","8050123481","' . $data['service_address1'] . '","' . $data['service_city'] . '","' . $data['service_state'] . '","' . $data['service_zipcode'] . '","N","P","PN001","Y","MCP2","1","4","0.02","Default","ESP"]]}}');
$url .= '&mode=' . urlencode('TEST');
$headersVal = array("application/x-www-form-uriencoded");
$myFile = "/tmp/isigma.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$ch = curl_init(); // Initialize a CURL session.
curl_setopt($ch, CURLOPT_URL, $url); // Pass URL as parameter.
curl_setopt($ch, CURLOPT_STDERR, $fh);
curl_setopt($ch, CURLOPT_POST, 1); // use this option to Post a form
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '1');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1');
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/iSIGMARootCA.crt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSLCERT, getcwd() . "/APN_Generic_JSON.pem");
curl_setopt($ch, CURLOPT_SSLKEY, getcwd() . "/apnakey.pem");
curl_setopt($ch, CURLOPT_SSLCERTTYPE, "PEM");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch); // grab URL and pass it to the variable.
curl_close($ch); // close curl resource, and free system resources.
fclose($fh);
$res_array = json_decode($result, true);
if (!empty($result)) {
return $res_array;
} else {
echo "Curl Error" . curl_error($ch);
}
}
thanks for help in advance..
I’m using this function to post data.
You can put an associative array as second parameter, the first is the url that you want to call.