In the courier.ini file located in the EMDI main folder we define the links:
1 2 3 4 5 6 7 |
[print] speedex=https://www.sbzsystems.com/apps/emdi/courier.php?action=printspeedex&voucher=#voucherno elta=C:\Program Files (x86)\ELTA_COURIER\ELTA_PRINT_SETUP\ELTA_PRINT.exe #senderid #courieruser #courierpass #voucherno acs=https://www.sbzsystems.com/apps/emdi/courier.php?action=printacs&voucher=#voucherno [general] temp=https://www.sbzsystems.com/apps/emdi/tmp/ script=https://www.sbzsystems.com/apps/emdi/courier.php |
The variables:
#senderid Sender code
#courieruser Login user
#courierpass Login password
#cpuser User
#cppass Password
#voucherno Voucher number
Calls to the Internet
EMDI calls the following links respectively:
Create shipping
courier Shipping company abbreviation
rec_date Shipping date
courieruser User name
courierpass Password
cpuser Application username
cppass Application password
senderid Sender code
rec_name Recipient name
rec_company Recipient company
rec_floor Recipient floor
rec_address Recipient address
rec_area Recipient area
rec_zip Recipient zip
rec_telephone Recipient phone
rec_mobile Recipient mobile
quantity Number of packages
weight Weight
notes Notes
cashondelivery Cash on delivery price
relateddoc Document number for which the voucher is issued
rec_country Country
sendername Sender name. There is also an option by right-clicking the voucher button on EMDI
action print in the specific movement
emdiuser EMDI license username
saturday Sunday 1 yes 0 no
exact Desired delivery time
special Special treatment
office Collection from store 1 yes 0 no
recipientbilling Recipient charge 1 yes 0 no
products Document items, if selected by right-clicking on the voucher button in EMDI
rec_date Shipping date
courieruser User name
courierpass Password
cpuser Application username
cppass Application password
senderid Sender code
rec_name Recipient name
rec_company Recipient company
rec_floor Recipient floor
rec_address Recipient address
rec_area Recipient area
rec_zip Recipient zip
rec_telephone Recipient phone
rec_mobile Recipient mobile
quantity Number of packages
weight Weight
notes Notes
cashondelivery Cash on delivery price
relateddoc Document number for which the voucher is issued
rec_country Country
sendername Sender name. There is also an option by right-clicking the voucher button on EMDI
action print in the specific movement
emdiuser EMDI license username
saturday Sunday 1 yes 0 no
exact Desired delivery time
special Special treatment
office Collection from store 1 yes 0 no
recipientbilling Recipient charge 1 yes 0 no
products Document items, if selected by right-clicking on the voucher button in EMDI
1 |
{script}?courier=&rec_date=&courieruser=&courierpass=&cpuser=&cppass=&senderid=&rec_name=&rec_company=&rec_floor=&rec_address=&rec_area=&rec_zip=&rec_telephone=&rec_mobile=&quantity=&weight=¬es=&cashondelivery=&relateddoc=&rec_country=GR&sendername=&action=print&emdiuser=&saturday=&exact=&special=&office= |
Open shipping
1 |
{script}?courier=&rec_date=&courieruser=&courierpass=&cpuser=&cppass=&senderid=&relateddoc=&voucher=&action=view&emdiuser=&lang= |
Cancel shipping
1 |
{script}?courier=&rec_date=&courieruser=&courierpass=&cpuser=&cppass=&senderid=&relateddoc=&voucher=&action=cancel&emdiuser=&lang= |
Print is taken from the link that is assigned to the respective company in the [print]
For example, the php script that receives calls from EMDI:
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 |
<?php require_once('courier_common.php'); $couriername = $_GET['courier']; $courieruser = $_GET['courieruser']; $courierpass = $_GET['courierpass']; $cpuser = $_GET['cpuser']; $cppass = $_GET['cppass']; $senderid = $_GET['senderid']; $rec_name = $_GET['rec_name']; $rec_address = $_GET['rec_address']; $rec_area = $_GET['rec_area']; $rec_zip = $_GET['rec_zip']; $rec_telephone = $_GET['rec_telephone']; $rec_mobile = $_GET['rec_mobile']; $quantity = $_GET['quantity']; $weight = $_GET['weight']; $notes = $_GET['notes']; $cashondelivery = $_GET['cashondelivery']; $relateddoc = $_GET['relateddoc']; $rec_country = $_GET['rec_country']; $rec_date = $_GET['rec_date']; $sendername = $_GET['sendername']; $action = $_GET['action']; $emdiuser = $_GET['emdiuser']; $voucher = $_GET['voucher']; $saturday = $_GET['saturday']; $exact = $_GET['exact']; $special = $_GET['special']; $lang = $_GET['lang']; $soapurl=''; $logfile='/home/sbz/domains/sbzsystems.com/public_html/apps/emdi/courier.log'; // $messages['Show voucher list'] = 'Show voucher list'; $messages['Create voucher receipt list'] = 'Create voucher receipt list'; $messages['Voucher'] = 'Voucher'; $messages['Date'] = 'Date'; $messages['Notes'] = 'Notes'; if (($couriername=='speedex') || ($action=='printspeedex') || ($action=='receiptspeedex') || ($action=='cancelspeedex')) { require_once('courier_speedex.php'); } ?> |
The script for speedex:
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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 |
<?php $userUN='speedex_'; $soapurl='http://www.speedex.gr/AccessPointTest/AccessPoint.asmx'; //$soapurl='http://www.speedex.gr/accesspoint/accesspoint.asmx'; if ($action=='print') { open_session(); $rec_date=substr($rec_date,0,4).'-'.substr($rec_date,4,2).'-'.substr($rec_date,6,2); $weight=number_format($weight, 2, '.', ''); if ($weight<0.5) { $weight=0.5; } $quantity=round(number_format($quantity, 2, '.', '')); $cashondelivery=number_format($cashondelivery, 2, '.', ''); if ($cashondelivery<>0) { $paymenttype='Μ'; } else { $paymenttype=''; } if ($exact) { $exact='2'; } else { $exact='0'; } if ($rec_telephone=='') { $rec_telephone= explode(',', $rec_mobile)[0]; $rec_mobile= explode(',', $rec_mobile)[1]; } $soap_request = ' <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spe="http://www.speedex.gr/"> <soap:Header/> <soap:Body> <spe:CreateBOLwithOrder> <spe:sessionID>'.$sessionid.'</spe:sessionID> <spe:inListPod> <spe:BOLOrder> <spe:voucher_code></spe:voucher_code> <spe:EnterBranchId>'.$cpuser.'</spe:EnterBranchId> <spe:charge_Customer_Id>'.$senderid.'</spe:charge_Customer_Id> <spe:charge_agreement_id>'.$cppass.'</spe:charge_agreement_id> <spe:SND_Company></spe:SND_Company> <spe:SND_Name>'.$sendername.'</spe:SND_Name> <spe:SND_Addr1></spe:SND_Addr1> <spe:SND_Addr2></spe:SND_Addr2> <spe:SND_Zip_Code></spe:SND_Zip_Code> <spe:SND_City></spe:SND_City> <spe:SND_Tel1></spe:SND_Tel1> <spe:SND_Tel2></spe:SND_Tel2> <spe:RCV_Afm></spe:RCV_Afm> <spe:RCV_DOY></spe:RCV_DOY> <spe:RCV_Company></spe:RCV_Company> <spe:RCV_Name>'.$rec_name.'</spe:RCV_Name> <spe:RCV_Addr1>'.$rec_address.'</spe:RCV_Addr1> <spe:RCV_Addr2></spe:RCV_Addr2> <spe:RCV_Zip_Code>'.$rec_zip.'</spe:RCV_Zip_Code> <spe:RCV_City>'.$rec_area.'</spe:RCV_City> <spe:RCV_Country>'.$rec_country.'</spe:RCV_Country> <spe:RCV_Tel1>'.$rec_telephone.'</spe:RCV_Tel1> <spe:RCV_Tel2>'.$rec_mobile.'</spe:RCV_Tel2> <spe:Voucher_Weight>'.$weight.'</spe:Voucher_Weight> <spe:Pod_Amount_Cash>'.$cashondelivery.'</spe:Pod_Amount_Cash> <spe:Security_Value>0</spe:Security_Value> <spe:Express_Delivery>0</spe:Express_Delivery> <spe:Saturday_Delivery>'.$saturday.'</spe:Saturday_Delivery> <spe:Time_Limit>'.$exact.'</spe:Time_Limit> <spe:Comments_2853_1></spe:Comments_2853_1> <spe:Comments_2853_2></spe:Comments_2853_2> <spe:Comments_2853_3></spe:Comments_2853_3> <spe:Comments>'.$notes.'</spe:Comments> <spe:Voucher_Volume>0</spe:Voucher_Volume> <spe:Pod_Amount_Description>'.$paymenttype.'</spe:Pod_Amount_Description> <spe:PayCode_Flag>1</spe:PayCode_Flag> <spe:BranchBankCode></spe:BranchBankCode> <spe:Paratiriseis_2853_1></spe:Paratiriseis_2853_1> <spe:Paratiriseis_2853_2></spe:Paratiriseis_2853_2> <spe:Paratiriseis_2853_3></spe:Paratiriseis_2853_3> <spe:email></spe:email> <spe:BasicService></spe:BasicService> <spe:Items>'.$quantity.'</spe:Items> <spe:Vouc_descr></spe:Vouc_descr> <spe:Comments_new></spe:Comments_new> <spe:_cust_Flag>0</spe:_cust_Flag> <spe:orderPickupDate>'.$rec_date.'</spe:orderPickupDate> <spe:orderPickupTimeFrom></spe:orderPickupTimeFrom> <spe:orderPickupTimeto></spe:orderPickupTimeto> <spe:returnFlag>0</spe:returnFlag> <spe:originalvoucher></spe:originalvoucher> <spe:originalkey1></spe:originalkey1> <spe:originalkey2></spe:originalkey2> <spe:originalkey3></spe:originalkey3> <spe:sendparalavi>0</spe:sendparalavi> </spe:BOLOrder> </spe:inListPod> <spe:tableFlag>3</spe:tableFlag> </spe:CreateBOLwithOrder> </soap:Body> </soap:Envelope> '; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", // "SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $soapurl ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); $xmlerr=get_between($result,'<returnMessage>','</returnMessage>'); $xmlres=get_between($result,'<voucher_code>','</voucher_code>'); $xmlres=html_entity_decode($xmlres); $xmlerr=html_entity_decode($xmlerr); //CREATE PDF $soap_request = ' <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spe="http://www.speedex.gr/"> <soap:Header/> <soap:Body> <spe:GetBOLPdf> <spe:sessionID>'.$sessionid.'</spe:sessionID> <spe:voucherIDs> <spe:string>'.$xmlres.'</spe:string> </spe:voucherIDs> <spe:perVoucher>1</spe:perVoucher> <spe:paperType>1</spe:paperType> </spe:GetBOLPdf> </soap:Body> </soap:Envelope> '; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", //"SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $soapurl ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); $pdf=get_between($result,'<pdf>','</pdf>'); $pdf=html_entity_decode($pdf); // file_put_contents($logfile, '#'.$pdf.'#', FILE_APPEND | LOCK_EX); $file = fopen('tmp/'.$userUN.$xmlres.'.pdf', "w+"); fputs($file, base64_decode($pdf) ); fclose($file); echo $xmlres.'|'.$xmlerr; close_session(); } //SPEEDEX PRINT VOUCHER if ($action=='printspeedex') { ?> <script type="text/javascript"> window.location.href = "tmp/<?php echo $userUN.$voucher; ?>.pdf"; </script> <?php } if ($action=='view') { open_session(); $soap_request = ' <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spe="http://www.speedex.gr/"> <soap:Header/> <soap:Body> <spe:GetTraceByVoucher> <spe:sessionID>'.$sessionid.'</spe:sessionID> <spe:VoucherID>'.$voucher.'</spe:VoucherID> </spe:GetTraceByVoucher> </soap:Body> </soap:Envelope> '; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // file_put_contents($logfile, '#'.$soap_request.'#', FILE_APPEND | LOCK_EX); $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", // "SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $soapurl ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); //$xmlres=$result;<returnMessage>Invalid RCV_Tel1</returnMessage>< $xmlres=get_between($result,'<returnMessage>','</returnMessage>'); $xmlres=html_entity_decode($xmlres); close_session(); $xmlres=$messages['Voucher'].': '.$voucher.'<br>'. //$messages['Date'].': '.get_between($result,'<diak_dateparal xsi:type="xsd:dateTime" xsi:nil="true">','</diak_dateparal>').'<br>'. $messages['Notes'].': '.$xmlres; $xmlres=html_entity_decode($xmlres); ?> <head> <title></title> </head> <body style="font-family: Arial, Helvetica, sans-serif; font-size: small;"> <?php echo $xmlres; //if (file_exists('tmp/'.$userUN.$emdiuser.$courieruser.'.txt')) { $prox="https://www.sbzsystems.com/apps/emdi/courier.php?courier=speedex&emdiuser=$emdiuser&courieruser=$courieruser&courierpass=$courierpass&cpuser=$cpuser&cppass=$cppass&action=receiptspeedex"; ?> <br><br> <a href="<?php echo $prox; ?>" target="_blank"><?php echo $messages['Show voucher list']; ?></a> <?php //echo showresults('tmp/'.$userUN.$emdiuser.$courieruser.'.txt'); //} ?> </body> </html> <?php } if ($action=='receiptspeedex') { // CREATE ReceiptsList /* $rec_date=''; $all=file_get_contents('tmp/'.$userUN.$emdiuser.$courieruser.'.txt'); $larray = explode("\n", $all); foreach ($larray as $item) { $narray = explode(";", $item); if ($narray[0]) { $sessionid=$narray[2]; $rec_date=$narray[1]; last; } } */ open_session(); $rec_date=date("Y-m-d");// substr($rec_date,0,4).'-'.substr($rec_date,4,2).'-'.substr($rec_date,6,2); //file_put_contents($logfile, '#'.$rec_date.'#'.$xmlres."##\n", FILE_APPEND | LOCK_EX); // CREATE ReceiptsList $soap_request = ' <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spe="http://www.speedex.gr/"> <soap:Header/> <soap:Body> <spe:GetBOLSummaryPdf> <spe:sessionID>'.$sessionid.'</spe:sessionID> <spe:beginDate>'.$rec_date.'T00:00:00</spe:beginDate> <spe:endDate>'.$rec_date.'T23:59:59</spe:endDate> </spe:GetBOLSummaryPdf> </soap:Body> </soap:Envelope> '; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", //"SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $soapurl ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); $pdf=get_between($result,'<GetBOLSummaryPdfResult>','</GetBOLSummaryPdfResult>'); $xmlerr=get_between($result,'<soap:Text xml:lang="en">','</soap:Text>'); $pdf=html_entity_decode($pdf); $xmlerr=html_entity_decode($xmlerr); //file_put_contents($logfile, '#'.$soap_request.'#'.$xmlerr, FILE_APPEND | LOCK_EX); //file_put_contents($logfile, '#'.$pdf.'#', FILE_APPEND | LOCK_EX); $file = fopen('tmp/'.$userUN.$emdiuser.$courieruser.'.pdf', "w+"); fputs($file, base64_decode($pdf) ); fclose($file); //$fp = fopen('tmp/'.$userUN.$emdiuser.$courieruser.'.pdf', 'w'); //fwrite($fp, $response); //fclose($fp); unlink('tmp/'.$userUN.$emdiuser.$courieruser.'.txt'); close_session(); //////////////// /////////////////// /////////////// ?> <script type="text/javascript"> window.location.href = "tmp/<?php echo $userUN.$emdiuser.$courieruser; ?>.pdf"; </script> <?php } if ($action=='cancelspeedex') { open_session(); // CANCEL ReceiptsList $soap_request = ' <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spe="http://www.speedex.gr/"> <soap:Header/> <soap:Body> <spe:CancelBOL> <spe:sessionID>'.$sessionid.'</spe:sessionID> <spe:voucherID>'.$voucher.'</spe:voucherID> </spe:CancelBOL> </soap:Body> </soap:Envelope> '; $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", //"SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $soapurl ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); //file_put_contents($logfile, '#'.$result.'#', FILE_APPEND | LOCK_EX); close_session(); } ////////////////////////////////////////////////////////////////// //////////////////// functions /////////////////////////////////// ////////////////////////////////////////////////////////////////// function open_session() { //OPEN SESSION $soap_request = ' <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spe="http://www.speedex.gr/"> <soap:Header/> <soap:Body> <spe:CreateSession> <spe:username>'.$GLOBALS['courieruser'].'</spe:username> <spe:password>'.$GLOBALS['courierpass'].'</spe:password> </spe:CreateSession> </soap:Body> </soap:Envelope> '; //file_put_contents($logfile, '#'.$soap_request.'#', FILE_APPEND | LOCK_EX); $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", //"SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $GLOBALS['soapurl'] ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); $sessionid=get_between($result,'<sessionId>','</sessionId>'); $xmlerr=get_between($result,'<returnMessage>','</returnMessage>'); $GLOBALS['xmlerr']=html_entity_decode($xmlerr); $GLOBALS['sessionid']=html_entity_decode($sessionid); } function close_session() { //CLOSE SESSION $soap_request = ' <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spe="http://www.speedex.gr/"> <soap:Header/> <soap:Body> <spe:DestroySession> <spe:sessionID>'.$GLOBALS['sessionid'].'</spe:sessionID> </spe:DestroySession> </soap:Body> </soap:Envelope> '; //file_put_contents($logfile, '#'.$soap_request.'#', FILE_APPEND | LOCK_EX); $header = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", //"SOAPAction: \"run\"", "Content-length: ".strlen($soap_request), ); $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $GLOBALS['soapurl']); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header); $result = curl_exec($soap_do); } ?> |