Last active
January 2, 2016 05:29
-
-
Save ssaunier/8257146 to your computer and use it in GitHub Desktop.
Simple snippet of PHP iframe to put in your website to integrate So Colissimo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// To be included in iframe 1100x550 | |
// Config from https://www.colissimo.fr/pudo-bo/configuration.htm | |
$front_office_identifier = 'YOUR_ID'; | |
$crypt_key = 'YOUR_KEY'; | |
// Form input fields. Order is important (for signature), do not change | |
$inputs = [ | |
"pudoFOId" => $front_office_identifier, | |
"ceName" => "Mon nom", | |
"dyPreparationTime" => "6", | |
"dyForwardingCharges" => "18,23", | |
"dyForwardingChargesCMT" => "2", | |
"trClientNumber" => "num client", | |
"trOrderNumber" => "num commande", | |
"orderId" => "test" . substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 12), | |
"numVersion" => "4.0", | |
"ceCivility" => "MLE", | |
"ceFirstName" => "Mon prenom", | |
"ceCompanyName" => "", | |
"ceAdress1" => "", | |
"ceAdress2" => "", | |
"ceAdress3" => "10 rue de paris", | |
"ceAdress4" => "", | |
"ceZipCode" => "75011", | |
"ceTown" => "PARIS", | |
"ceEntryPhone" => "Interphone", | |
"ceDeliveryInformation" => "infos compl", | |
"ceEmail" => "test@test.fr", | |
"cePhoneNumber" => "0600000004", | |
"ceDoorCode1" => "porte 1", | |
"ceDoorCode2" => "porte 2", | |
"dyWeight" => "12450", | |
"trFirstOrder" => "0", | |
"trParamPlus" => "Param plus", | |
"trReturnUrlKo" => "http://lvh.me/socolissimo/retourko.php", | |
"trReturnUrlOk" => "http://lvh.me/socolissimo/retourok.php", | |
"CHARSET" => "UTF-8", | |
"cePays" => "FR", | |
"trInter" => "1", | |
"ceLang" => "FR" | |
]; | |
$to_sign = join("", array_values($inputs)) . $crypt_key; | |
$inputs["signature"] = sha1($to_sign); | |
?> | |
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
</head> | |
<body> | |
<form id="form" action="http://ws.colissimo.fr/pudo-fo-frame/storeCall.do" method="post"> | |
<?php | |
foreach($inputs as $key => $value) { | |
echo "<input type='hidden' name='$key' value='$value' />\n"; | |
} | |
?> | |
</form> | |
<script type="text/javascript"> | |
document.getElementById("form").submit(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment