Hello,
i want to create a PHP file to read tracking number from parameter of URL and then to POST to cs cart API.
My problem is how to POST in the JSON the mandatory field of products.
<?php $A = false; if(isset($_GET['wo'])){ $WO = $_GET['wo']; } $B = false; if(isset($_GET['v'])){ $V = $_GET['v']; } $curl = curl_init(); ... ... ... ... ... ... $data_shipment = array( "carrier" => "", "order_id" => $A, "products" => array( "3910130838" => "1", //HERE is my problem, how to GET the product ids from order and POST them ), "shipping" => "TEST", "shipping_id" => "1", "user_id" => "0", "tracking_number" => $B ); $update_shipment = callAPI('POST', 'https://www.test.com/api/shipments', json_encode($data_shipment));
Can anyone help me with this?