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
| <?php $client = new SoapClient("http://202.XXX.XXX.132/SomeApp/mobileservice.asmx?WSDL", array( 'proxy_host' => '127.0.0.1', 'proxy_port' => 8888 ));
$voyageList = $client->getVoyageList(array( 'lang' => 'T', 'parameters' => array( array('sailDate', '2013-11-06'), array('sailDateReturn', '2013-11-07'),
array('fromPortCode', 'HKC'), array('toPortCode', 'ZS'),
array('fromPortCodeReturn', 'ZS'), array('toPortCodeReturn', 'HKC'),
array('currencyCode', 'HKD'), array('discounttype', '1'), array('isRoundtrip', '1'), ) ));
$voyageListResult = $voyageList->getVoyageListResult;
$dom = new DomDocument('1.0', 'UTF-8'); $dom->loadXML($voyageListResult->any);
$dataset_main = $dom->getElementsByTagName('resultset');
if ($dataset_main->length >= 1) { $forwards = $dataset_main->item(0)->getElementsByTagName('Forward');
for($i=0; $i<$forwards->length; $i++) { $forward = $forwards->item($i);
$fromport = $forward->getElementsByTagName('FROMPORT')->item(0)->nodeValue; $toport = $forward->getElementsByTagName('TOPORT')->item(0)->nodeValue; $fportcode = $forward->getElementsByTagName('FPORTCODE')->item(0)->nodeValue; $tportcode = $forward->getElementsByTagName('TPORTCODE')->item(0)->nodeValue; $ship = $forward->getElementsByTagName('SHIP')->item(0)->nodeValue; $shipcode = $forward->getElementsByTagName('SHIPCODE')->item(0)->nodeValue; $setofftime = $forward->getElementsByTagName('SETOFFTIME')->item(0)->nodeValue; $setofftime1 = $forward->getElementsByTagName('SETOFFTIME1')->item(0)->nodeValue; $sellstatus = $forward->getElementsByTagName('SELLSTATUS')->item(0)->nodeValue; $status = $forward->getElementsByTagName('STATUS')->item(0)->nodeValue; $linecode = $forward->getElementsByTagName('LINECODE')->item(0)->nodeValue; $voyagerouteid = $forward->getElementsByTagName('VOYAGEROUTEID')->item(0)->nodeValue; $ticketnum = $forward->getElementsByTagName('TICKETNUM')->item(0)->nodeValue;
if ($i === 0) { printf("===========================================\n"); }
printf("%-20s: %s\n", "From port", $fromport); printf("%-20s: %s\n", "From port code", $fportcode);
printf("%-20s: %s\n", "To port", $toport); printf("%-20s: %s\n", "To port code", $tportcode);
printf("%-20s: %s\n", "Ship Name", $ship); printf("%-20s: %s\n", "Ship Code", $shipcode); printf("%-20s: %s\n", "Set of Clock", $setofftime); printf("%-20s: %s\n", "Set of Time", $setofftime1);
printf("%-20s: %s\n", "Sell status", $sellstatus); printf("%-20s: %s\n", "Normal status", $status);
printf("%-20s: %s\n", "Line Code", $linecode); printf("%-20s: %s\n", "Voyage Route ID", $voyagerouteid);
printf("%-20s: %s\n", "Ticket Number", $ticketnum);
printf("............................................\n");
$seatranks = $forward->getElementsByTagName('SEATRANK'); $seatprice1s = $forward->getElementsByTagName('PRICE1'); $seatprice2s = $forward->getElementsByTagName('PRICE2');
for($j=0; $j<$seatranks->length; $j++) { $name = $seatranks->item($j)->nodeValue; $price1 = $seatprice1s->item($j)->nodeValue; $price2 = $seatprice2s->item($j)->nodeValue;
printf("%-20s: %s\n", "Seat Name", $name); printf("%-20s: %s\n", "Seat Price", $price1); printf("%-20s: %s\n", "Seat Price", $price2); }
printf("===========================================\n"); } }else{ echo "Not found data"; }
|