У меня следующий вызов SOAP, и я пытаюсь преобразовать вывод в другой формат. Я не могу заставить его работать правильно. Буду признателен за любую помощь.
public function __construct($coid, $env, $app_id, $product)
{
$url = APP_ROOT."dev/install/wsdl/my.wsdl";
try {
$soapclient = new SoapClient($url);
//This overwrites the location at the bottom of the WSDL file
$soapclient->__setLocation('http://exampleurl');
$params = array('clientOid' => $coid);
$response =$soapclient->getClientSetup($params);
print_r($response);
echo "--------";
var_dump($array);
} catch (Exception $e) {
echo $e->getMessage();
}
}
Мой вывод выглядит следующим образом (обратите внимание, что там также нет productUrl, и мне нужен этот ключ для отображения)
[
{
clientSetup: {
selectedProducts: {
0: {
code: "1001",
description: "datapoint 1"
},
1: {
code: "1049",
description: "datapoint 2"
},
2: {
code: "1032",
description: "datapoint 3"
},
3: {
code: "1013",
description: "datapoint 4"
}
}
}
}
]
Мне бы хотелось выглядеть так:
[
{
code: 1001,
description: "datapoint 1",
productUrl: "NO_URL"
},
{
code: 1089,
description: "datapoint2",
productUrl: "http://example.com/"
},
{
code: 2101,
description: "datapoint2",
productUrl: "NO_URL"
}
]