Last active
August 29, 2015 14:13
-
-
Save janewang/447a32743a6e367c3166 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$data = '<soap:Header><soap:Header/><soap:Body><PLGetOrderStatusResponse xmlns="http://prolog3pl.com/"><PLGetOrderStatusResult><Orders><PLOrderStatusHeader><ProLogOrderId>494478</ProLogOrderId><OrderNumber>12210</OrderNumber><Status>SHIPPED</Status><CompletedDate>15-01-05T00:00:00.00</CompletedDate><ShippingService>UPSG</ShippingService><LastUpdatedDate>2015-01-05T14:43:00.00</LastUpdatedDate><Lines><PLOrderStatusLine><ProLogLineId>1</ProLogLineId><LineNumber>1</LineNumber><Product>SWB-RED06</Product><QuantityOrdered>1</QuantityOrdered><QuantityShipped>1</QuantityShipped><QuantityBackordered>0</QuantityBackordered></PLOrderStatusLine></Lines><Shipments><PLOrderStatusShipment><ProLogShipmentId>494478</ProLogShipmentId><Warehouse>NEVADA DISTRIBUTION</Warehouse><ShippingService>UPSG</ShippingService><Status>SHIPPED</Status><ShippedDate>15-01-05T00:00:00.00</ShippedDate><Packages><PLOrderStatusPackage><ProLogTrackingNumber>1ZE31843YW46367974</ProLogTrackingNumber><TrackingNumber>1ZE31843YW46367974</TrackingNumber><ShippedDate>15-01-05T00:00:00.00</ShippedDate><Weight>1.00</Weight><Cost>25.00000</Cost><Contents><PLOrderStatusPackageContent><Product>SWB-RED06</Product><Quantity>1</Quantity><Sku>SWB-RED06</Sku><SkuQuantity>1</SkuQuantity><Lots/><Serials/></PLOrderStatusPackageContent></Contents></PLOrderStatusPackage></Packages></PLOrderStatusShipment></Shipments></PLOrderStatusHeader></Orders><ProLogCode>SUCCESS</ProLogCode></PLGetOrderStatusResult></PLGetOrderStatusResponse></soap:Body> | |
<soap:Header><soap:Header/><soap:Body><PLGetOrderStatusResponse xmlns="http://prolog3pl.com/"><PLGetOrderStatusResult><Orders><PLOrderStatusHeader><ProLogOrderId>494553</ProLogOrderId><OrderNumber>12307</OrderNumber><Status>SHIPPED</Status><CompletedDate>15-01-05T00:00:00.00</CompletedDate><ShippingService>USPS</ShippingService><LastUpdatedDate>2015-01-05T14:59:00.00</LastUpdatedDate><Lines><PLOrderStatusLine><ProLogLineId>1</ProLogLineId><LineNumber>1</LineNumber><Product>GWB-ORG</Product><QuantityOrdered>1</QuantityOrdered><QuantityShipped>1</QuantityShipped><QuantityBackordered>0</QuantityBackordered></PLOrderStatusLine></Lines><Shipments><PLOrderStatusShipment><ProLogShipmentId>494553</ProLogShipmentId><Warehouse>NEVADA DISTRIBUTION</Warehouse><ShippingService>USPS</ShippingService><Status>SHIPPED</Status><ShippedDate>15-01-05T00:00:00.00</ShippedDate><Packages><PLOrderStatusPackage><ProLogTrackingNumber>9405510200793407944867</ProLogTrackingNumber><TrackingNumber>9405510200793407944867</TrackingNumber><ShippedDate>15-01-05T00:00:00.00</ShippedDate><Weight>1.00</Weight><Cost>25.00000</Cost><Contents><PLOrderStatusPackageContent><Product>GWB-ORG</Product><Quantity>1</Quantity><Sku>GWB-ORG</Sku><SkuQuantity>1</SkuQuantity><Lots/><Serials/></PLOrderStatusPackageContent></Contents></PLOrderStatusPackage></Packages></PLOrderStatusShipment></Shipments></PLOrderStatusHeader></Orders><ProLogCode>SUCCESS</ProLogCode></PLGetOrderStatusResult></PLGetOrderStatusResponse></soap:Body>'; | |
$p = xml_parser_create(); | |
xml_parse_into_struct($p, $data, $vals, $index); | |
xml_parser_free($p); | |
foreach($vals as $val){ | |
if($val['tag'] == 'TRACKINGNUMBER' && isset($val['value'])){ | |
$trackid = $val['value']; | |
print $trackid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment