/* cargooffice api post test post a 'neworder' parameters: - sig signature (see authentication below) - ts time stamp (see authentication below) Authentication Each api user must have a unique api-key. If you want one then please contact us by sending us a request through our bug tracking system. The key should be kept Secret and can only be used on the clients' server. The key will never be passed in a request, but mixed with a 'unique number' (unix-timestamp) in md5 format. Like this: $secretkey= "abcdefabcdef"; $timestamp = mktime(date()); $signature = md5( $timestamp . $secretkey); The signature is passed in the url along with the timestamp in its original form. */ $url = "http://yourcompany.cargooffice.com/api/neworder/?sig=6cb31538570398c35e9f8e&ts=20140611161300"; $post = "deliveryName=test name&deliveryAddress=test address&status=2014-06-11 16:13 new order"; // Init cURL session $ch = curl_init($url); // Set cUrl options curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($ch, CURLOPT_TIMEOUT, 4); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 50); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); // grab URL and capture output $result = curl_exec($ch); $resultCode = curl_errno($ch); $resultString = curl_error($ch); // close cURL resource, and free up system resources curl_close($ch); echo "
"; echo "\nresult = $result"; echo "\nresultCode = $resultCode"; echo "\nresultString = $resultString"; ?>