1234 ref121212 Normal delivery Test B.V. Science Park 402 1098 XH Amsterdam NL 20-08-20 11:00 Philips Boven Heining 2 4891PR ... ... "; /* send the following post fields: data the raw EDI data, for example an xml formatted order dataType xml, csv, xls, etc.. this indicates the type of data customerID customerID, new new orders will get this customerID errorMail (optional) an email address to send errors to if the EDI data can't be processed fileName (optional) a optional filename (not necessary) */ $postFields = [ 'data' => $EDIdata, 'dataType' => 'xml', 'customerID' => '123456', ]; // use the following url: $secretkey = "klmnopqrst123"; // replace this by the secret key you received from us $ts = time(); $sig = md5($ts . $secretkey); $url = "https://loginet.cargooffice.com/api/postEDIorder/?sig=$sig&ts=$ts"; // replace 'loginet' by your company name // use file_get_contents to send the data: $options = array( 'http' => array( 'method' => 'POST', // we are using the POST HTTP method 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($postFields) // the URL-encoded query string ) ); $streamContext = stream_context_create($options); $response = file_get_contents($url, false, $streamContext); if($response === false){ $error = error_get_last(); die ('POST request failed: ' . $error['message']); } /* // this example uses cURL to send the data: $ch = curl_init($url); // set the 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, http_build_query($postFields)); // execute the URL and capture the response: $response = curl_exec($ch); $responseCode = curl_errno($ch); $responseString = curl_error($ch); // close cURL resource, and free up system resources curl_close($ch); */ echo "
";
echo "\nresponse = $response";
echo "\nresponseCode = $responseCode";
echo "\nresponseString = $responseString";
?>