1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<?php
try
{
$date=date('Y-m-d\TH:i:s\+02:00');
$client=new SoapClient("http://ws.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl",array("trace" => 1, "exception" => 0));
$debut = array(
'headerValue' => array(
'idEmit' => 'CHRFR',
'accountNumber' => '19869502',
'subAccount'=>''
),
'shipperValue' => array(
'shipperCivility' => 'M',
'shipperName' => 'EXPEDITEUR',
'shipperName2' => '',
'shipperAdress1' => 'RUE EXPEDITEUR',
'shipperAdress2' => '',
'shipperZipCode' => '75001',
'shipperCity' => 'PARIS',
'shipperCountry' => 'FR',
'shipperCountryName'=>'FRANCE',
'shipperEmail'=>'mail@expediteur.fr',
'shipperPreAlert'=>'0'
),
'customerValue' => array(
'customerCivility' => 'M',
'customerName' => 'DONNEUR ORDRE',
'customerName2' => '',
'customerAdress1' => 'RUE DONNEUR ORDRE',
'customerAdress2' => '',
'customerZipCode' => '75001',
'customerCity' => 'PARIS',
'customerCountry' => 'FR',
'customerCountryName'=>'FRANCE',
'customerEmail' => 'mail@donneurordre.fr',
'customerPhone' => '0999999999',
'customerMobilePhone' => '0999999999',
'customerPreAlert'=>'0'
),
'recipientValue' => array(
'recipientName' => 'DESTINATAIRE',
'recipientName2' => '',
'recipientAdress1' => 'RUE DESTINATAIRE',
'recipientAdress2' => '',
'recipientZipCode' => '31000',
'recipientCity' => 'TOULOUSE',
'recipientCountry' => 'FR',
'recipientCountryName'=>'FRANCE',
'recipientEmail' => 'mail@destinataire.fr',
'recipientPhone' => '0999999999',
'recipientMobilePhone' => '0999999999',
'recipientPreAlert'=>'0'
),
'refValue' => array(
'shipperRef' => 'REF EXPEDITEUR',
'recipientRef' => 'REF DESTINATAIRE'
),
);
$array2 = array(
'skybillValue' => array(
'bulkNumber' => '2',
'productCode' => '01',
'shipDate' =>$date,
'shipHour' => '11',
'evtCode'=>'DC',
'weight' => '5',
'weightUnit' => 'KGM',
'service' => '0',
'objectType' => 'MAR',
'skybillRank' => '1',
'height' => '150',
'length' => '20',
'width' => '25',
'objectType'=>'MAR'
),
);
$array3 = array(
'skybillValue' => array(
'bulkNumber' => '2',
'productCode' => '01',
'shipDate' =>$date,
'shipHour' => '11',
'evtCode'=>'DC',
'weight' => '5',
'weightUnit' => 'KGM',
'service' => '0',
'objectType' => 'MAR',
'skybillRank' => '2',
'height' => '150',
'length' => '20',
'width' => '25',
'objectType'=>'MAR'
),
);
$fin = array(
'skybillParamsValue' => array(
'mode' => 'PDF',
'withReservation'=>'0',
),
'password' => '255562',
'modeRetour' => '2',
'numberOfParcel' => '2',
'multiParcel'=>'Y',
'version'=>'2.0',
);
var_dump($debut, $array2, $array3, $fin);
$result=$client->shippingMultiParcelV4($debut, $array2, $array3, $fin);
$binaire=$result->return->resultMultiParcelValue->pdfEtiquette;
$filename=$result->return->resultMultiParcelValue->skybillNumber.'.pdf';
$fichier=fopen($filename,"w+");
fwrite($fichier,$binaire);
fclose($fichier);
// Header content type
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
@readfile($filename);
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
?> |
Partager