<?php
$privateKey = '0ac56cf42961b3a00e3a54e8608ac56628331a1a21e28e44288b713442c05d9c'; //your private-key
$publicKey = 'd7830ae49fbe30ce79aa033662057fcb8c0d57959411066208444d709c3cd87a'; //your public-key
$resource = '/shipment/'; //uri of a resource
$timestamp = time();
//only needed for the testing-server
$baseUrl = 'https://testing.swissconnect.ch/api/';
$basicAuthUser = 'swissconnect';
$basicAuthPass = 't3St-M4th1lda';
$contentData = '<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_SWISSCONNECT_REQUEST xmlns:ns0="http://postlogistics.schindler.com"><auftrag><system_fk_id>9999</system_fk_id><startdatum>2014-10-24 14:40:44</startdatum><rechnungsbeschreibung_offiziell>4700946399 / S-GE</rechnungsbeschreibung_offiziell><rechnungssteller>2</rechnungssteller><bezahl_kurier_id>600</bezahl_kurier_id><bemerkung>bitte Monteur 30 Min. vorher anrufen / Appelez le monteur 30 Min. avant svp.</bemerkung><auftrag_absender_kontaktadressen><item><firma>Schindler AufzÃ1Ž4ge AG</firma><addresse>Zugerstrasse 13</addresse><postleitzahl>6030</postleitzahl><ort>Ebikon</ort></item></auftrag_absender_kontaktadressen><auftrag_empfaenger_kontaktadressen><item><firma>Schindler AufzÃ1Ž4ge AG</firma><addresse>Friedgrabenstrasse 15</addresse><postleitzahl>8907</postleitzahl><ort>Wettswil</ort><kontakt>Kapinos Tobias / 044 172 8484 844</kontakt></item></auftrag_empfaenger_kontaktadressen><auftrag_dritte_kontaktadressen><item><kontaktadresse_id>62300</kontaktadresse_id><bezahlt_bool>true</bezahlt_bool></item></auftrag_dritte_kontaktadressen><colis><item><anzahl>1</anzahl><gewicht>0.035 </gewicht><laenge>20.000 </laenge><breite>20.000 </breite><hoehe>20.000 </hoehe><beschreibung>Paket</beschreibung></item></colis><auftrag_kuriere_dritte><item><kurier_id>101</kurier_id></item></auftrag_kuriere_dritte></auftrag></ns0:MT_SWISSCONNECT_REQUEST>';
//For the hash-key we do not need the serverPW
$url = $baseUrl . $privateKey . '/' . $timestamp . $resource;
//generating hash which has to be placed in the header of the request. Header name: X-hash
$resultHash = hash('sha256', $url . $contentData);
$sendUrl = $baseUrl . $publicKey . '/' . $timestamp . $resource;
$httpHeaders = array(
"Content-Type: application/xml",
"Accept: application/xml",
"X-hash: " . $resultHash,
"X-language: de",
"Authorization: Basic ". base64_encode($basicAuthUser. ':'. $basicAuthPass),
);
$httpheaderstring = implode(",", $httpHeaders);
echo '$HTTP_HEADER..: '.$httpheaderstring."\n";
echo '$TIMESTAMP....: '.$timestamp."\n";
echo '$SEND_URL.....: '.$sendUrl."\n";
echo '$RESULTHASH...: '.$resultHash."\n";
echo '$URL_FOR_HASH.: '.$url."\n";
echo '$CONTENTDATA..: '.$contentData."\n";
- Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.13, 7.3.0 - 7.3.1
- $HTTP_HEADER..: Content-Type: application/xml,Accept: application/xml,X-hash: 976522aa8ba5efbf3370698377fe88ccf5660beb78cbede88f438f25e46f20dd,X-language: de,Authorization: Basic c3dpc3Njb25uZWN0OnQzU3QtTTR0aDFsZGE=
$TIMESTAMP....: 1415009526
$SEND_URL.....: https://testing.swissconnect.ch/api/d7830ae49fbe30ce79aa033662057fcb8c0d57959411066208444d709c3cd87a/1415009526/shipment/
$RESULTHASH...: 976522aa8ba5efbf3370698377fe88ccf5660beb78cbede88f438f25e46f20dd
$URL_FOR_HASH.: https://testing.swissconnect.ch/api/0ac56cf42961b3a00e3a54e8608ac56628331a1a21e28e44288b713442c05d9c/1415009526/shipment/
$CONTENTDATA..: <?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_SWISSCONNECT_REQUEST xmlns:ns0="http://postlogistics.schindler.com"><auftrag><system_fk_id>9999</system_fk_id><startdatum>2014-10-24 14:40:44</startdatum><rechnungsbeschreibung_offiziell>4700946399 / S-GE</rechnungsbeschreibung_offiziell><rechnungssteller>2</rechnungssteller><bezahl_kurier_id>600</bezahl_kurier_id><bemerkung>bitte Monteur 30 Min. vorher anrufen / Appelez le monteur 30 Min. avant svp.</bemerkung><auftrag_absender_kontaktadressen><item><firma>Schindler AufzÃ1Ž4ge AG</firma><addresse>Zugerstrasse 13</addresse><postleitzahl>6030</postleitzahl><ort>Ebikon</ort></item></auftrag_absender_kontaktadressen><auftrag_empfaenger_kontaktadressen><item><firma>Schindler AufzÃ1Ž4ge AG</firma><addresse>Friedgrabenstrasse 15</addresse><postleitzahl>8907</postleitzahl><ort>Wettswil</ort><kontakt>Kapinos Tobias / 044 172 8484 844</kontakt></item></auftrag_empfaenger_kontaktadressen><auftrag_dritte_kontaktadressen><item><kontaktadresse_id>62300</kontaktadresse_id><bezahlt_bool>true</bezahlt_bool></item></auftrag_dritte_kontaktadressen><colis><item><anzahl>1</anzahl><gewicht>0.035 </gewicht><laenge>20.000 </laenge><breite>20.000 </breite><hoehe>20.000 </hoehe><beschreibung>Paket</beschreibung></item></colis><auftrag_kuriere_dritte><item><kurier_id>101</kurier_id></item></auftrag_kuriere_dritte></auftrag></ns0:MT_SWISSCONNECT_REQUEST>
- Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
- Fatal error: Call to undefined function hash() in /in/Z6Abb on line 22
Process exited with code 255. - Output for 4.4.5 - 4.4.9
- Fatal error: Call to undefined function: hash() in /in/Z6Abb on line 22
Process exited with code 255. - Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
- Fatal error: Call to undefined function: hash() in /in/Z6Abb on line 22
Process exited with code 255. - Output for 4.3.0 - 4.3.1
- Fatal error: Call to undefined function: hash() in /in/Z6Abb on line 22
preferences:
172.19 ms | 401 KiB | 233 Q