alpha_full/pages/panier/shippyPro/modeLiv.shippyProForm.php
2026-04-06 22:58:51 +02:00

86 lines
2.6 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
$apiKey= "61c0df6d775aef4d3d38668b7f50dc3d";
$ready=0;
if ($ready==0) {
echo '<b>Attention ! chippyPro non encore en place</b>';
}
else
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.shippypro.com/api
");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{
\"Method\": \"Ship\",
\"Params\": {
\"to_address\": {
\"name\": \"John Doe\",
\"company\": \"\",
\"street1\": \"123 Main St\",
\"street2\": \"\",
\"city\": \"Park City\",
\"state\": \"UT\",
\"zip\": \"84060\",
\"country\": \"US\",
\"phone\": \"5551231234\",
\"email\": \"johndoe@gmail.com\"
},
\"from_address\": {
\"name\": \"John Doe\",
\"company\": \"\",
\"street1\": \"123 Main St\",
\"street2\": \"\",
\"city\": \"Park City\",
\"state\": \"UT\",
\"zip\": \"84060\",
\"country\": \"US\",
\"phone\": \"5551231234\",
\"email\": \"johndoe@gmail.com\"
},
\"parcels\": [
{
\"length\": 5,
\"width\": 5,
\"height\": 5,
\"weight\": 10
}
],
\"TotalValue\": \"123 EUR\",
\"TransactionID\": \"ORDER2365\",
\"ContentDescription\": \"Milk\",
\"Insurance\": 0,
\"InsuranceCurrency\": \"EUR\",
\"CashOnDelivery\": 0,
\"CashOnDeliveryCurrency\": \"EUR\",
\"CashOnDeliveryType\": 0,
\"CarrierName\": \"DHLExpress\",
\"CarrierService\": \"EXPRESS DOMESTIC\",
\"CarrierID\": 23,
\"OrderID\": \"\",
\"RateID\": \"14922625303744\",
\"Incoterm\": \"DAP\",
\"BillAccountNumber\": \"\",
\"PaymentMethod\": \"Paypal\",
\"Note\": \"Ship by 25/06/2018\",
\"Async\": false
}
}");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Authorization: Basic " . base64_encode("61c0df6d775aef4d3d38668b7f50dc3d" . ":")
// "Authorizatio:n: Basic " . base64_encode("61c0df6d775aef4d3d38668b7f50dc3d" . ":")
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
}
?>