Hi There,
I am having an issue with a CURL POST causing double submissions for some reason. I have seen in some previous posts that this can be to do with how the results are printed however I have removed these steps and Im experiencing the same issues.
$final_JSON = json_encode($main_array2);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "API-URL-HERE",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"APIKey\": \"API-KEY\",\n \"SiteID\": \"SITE-ID\",\n \"UserID\":USER-ID\",\n \"OrderItems\": [\n {\n \"ID\": \"cce12148-62c0-4704-a5a2-8b81a5d7734f\",\n \"Quantity\": \"1\",\n \"ModifierOptions\": [\n {\n \"ID\": \"69904\",\n \"Quantity\": \"1\"\n },\n {\n \"ID\": \"69907\",\n \"Quantity\": \"1\"\n },\n {\n \"ID\": \"69913\",\n \"Quantity\": \"1\"\n },\n {\n \"ID\": \"69924\",\n \"Quantity\": \"1\"\n },\n {\n \"ID\": \"70137\",\n \"Quantity\": \"1\"\n }\n ]\n }\n ],\n \"OrderType\": \"0\",\n \"RequiredDate\": \"27/04/20\",\n \"RequiredTime\": \"18:30\",\n \"Name\": \"DO NOT PREP\",\n \"DeliveryAddress\": \"PICKUP FROM SHOP\",\n \"DeliveryPostcode\": \"KT21 2DB\",\n \"TelNo\": \"00000\",\n \"Email\": \"[email protected]\",\n \"Payment\": {\n \"PaymentType\": \"4\",\n \"TransactionID\": \"1234\"\n },\n \"Discount\": \"0.00\",\n \"OrderTotal\": \"12.25\"\n}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
curl_exec($curl);
curl_close($curl);
Any Ideas of what is occurring ?
Thanks