Jump to content



Member Since 25 Oct 2013
Offline Last Active Oct 29 2013 07:45 PM

Topics I've Started

Updating tracking number through API

27 October 2013 - 04:55 PM

I am having some serious trouble finding out how to update tracking number on a order through the API.

I am using the helper class stickied in the forums to do this. I have tried some different things but to no avail. If anyone has done this before, either with clean php cURL or via the helper class, please post an example. I am completely stuck right now at this problem.

CS-Cart API and PHP cURL

25 October 2013 - 09:06 PM

I am trying to communicate via the API for CS-Cart and having some troubles. I am able to fetch data successfully, but not putting data. I have tried the helper class in this forum as well as regular PHP cURL requests.

I get this error: "Method Not Allowed: O" Status: 405.

It would help if anyone had any working examples of PHP cURL using "PUT". I do not use mod_rewrite for this. So my calls are towards example:

My code (Real passwords, usernames and url is omitted in example):
$order_data = json_encode(array('timestamp' => 1382548160) );
$order_id = "13752";
$query_string = "?_d=orders&order_id=$order_id";

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_URL, 'http://example.com/api.php'.$query_string);
curl_setopt($ch, CURLOPT_USERPWD, $usr . ":" . $pass);
curl_setopt($ch, CURLOPT_POSTFIELDS,$order_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($order_data))

$result = curl_exec($ch);

echo $result;


Hope any one can help. :)