I am trying to integrate a shipping API with my app. I send my details to a SOAP client and I'm recieiving an object array in return which I am unable to parse. Following is the array. Please help me parse this:
object(stdClass)#29 (4) {
["Transaction"]=>
object(stdClass)#30 (5) {
["Reference1"]=>
string(0) ""
["Reference2"]=>
string(0) ""
["Reference3"]=>
string(0) ""
["Reference4"]=>
string(0) ""
["Reference5"]=>
string(0) ""
}
["Notifications"]=>
object(stdClass)#31 (0) {
}
["HasErrors"]=>
bool(false)
["Shipments"]=>
object(stdClass)#32 (1) {
["ProcessedShipment"]=>
object(stdClass)#33 (8) {
["ID"]=>
string(10) "42939401"
["Reference1"]=>
string(9) "100000002"
["Reference2"]=>
string(0) ""
["Reference3"]=>
string(0) ""
["ForeignHAWB"]=>
string(0) ""
["HasErrors"]=>
bool(false)
["Notifications"]=>
object(stdClass)#34 (0) {
}
["ShipmentLabel"]=>
object(stdClass)#35 (2) {
["LabelURL"]=>
string(76) "http://content/rpt_cache/9c0d152bbcdc4e739132d2dsda5506.pdf"
["LabelFileContents"]=>
NULL
}
}
}
}
I took this response in $response
variable and tried the following but none of these work:
echo $order = $response["Shipments"]["ProcessedShipment"]["Reference1"];
echo $hawb = $response["Shipments"]["ProcessedShipment"]["ID"];
echo $barcode = $response["Shipments"]["ProcessedShipment"]["ShipmentLabel"]["LabelURL"];
I can't try too much because there is no testing framework with the service I have to manually cancel all the shipments I create. Please tell me what to do.
Thanks in advance for all the help.