<?php
// 1st we need to generate an order reference ID
$sURL = 'https://store.calicutgrocers.com/index.php?route=checkout/cart/genOrderRef';
$varOrderItems[0] = array("fname" => "Ajmal", "lname" => "Muhammad P", "email" => "myemail@gmail.com", "phone" => "9876543210", "hname" => "Thaiff, 8/295", "landmark" => "Near School", "address" => "Beach Road", "city" => "Calicut", "pincode" => "673032");
$varOrderItems[1] = array("pid" => 180, "qty" => 2, "opt" => "2kg");
$varOrderItems[2] = array("pid" => 208, "qty" => 3, "opt" => "500g");
// Your JSON data should be like this
// '[{"fname":"Ajmal","lname":"Muhammad P","email":"myemail@gmail.com","phone":"9876543210","hname":"Thaiff, 8/295","landmark":"Near School","address":"Beach Road","city":"Calicut","pincode":"673032"},
// {"pid":180,"qty":2,"opt":"2kg"},{"pid":208,"qty":2,"opt":"500g"}]');
$varData = 'data=' . json_encode($varOrderItems);
$ch = curl_init($sURL);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $varData);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Store the generated Order Reference ID
$sOrderRefCode = curl_exec($ch);
// Go to bulkAdd URL by passing above generated reference code
header('location: https://store.calicutgrocers.com/index.php?route=checkout/cart/bulkAdd&refid=' . $sOrderRefCode);
1. [{"fname":"Ajmal","lname":"Muhammad P","email":"myemail@gmail.com","phone":"9876543210","hname":"Thaiff, 8/295","landmark":"Near School","address":"Beach Road","city":"Calicut","pincode":"673032"},{"pid":180,"qty":2,"opt":"2kg"},{"pid":208,"qty":2,"opt":"500g"}]
2. [{"pid":161,"qty":5,"opt":"250g"},{"pid":56,"qty":2,"opt":"2kg"},{"pid":273,"qty":1,"opt":"100 Numbers"},{"pid":274,"qty":4,"opt":"500g"}]