//Create the client object
$soapclient = new SoapClient('http://www.webservicex.net/globalweather.asmx?WSDL');
// Use the functions of the client, the params of the function are in the associative array.
$params = array('CountryName' => 'Spain');
$response = $soapclient->GetCitiesByCountry($params);
var_dump($response);
foreach ($response as $key => $value) {
echo $value;
}
Используя Еогеасп я получаю все строки в $value
какзначение доступа от ответа клиента SOAP
SpainFuerteventura/Aeropuerto
SpainHierro/Aeropuerto
...
Как я могу получить все названия стран в одном массиве и все названия городов в другом массиве?
образец: var_dump($response);
object(stdClass)[2]
public 'GetCitiesByCountryResult' => string '<NewDataSet>
<Table>
<Country>Spain</Country>
<City>Fuerteventura/Aeropuerto</City>
</Table>
<Table>
<Country>Spain</Country>
<City>Hierro/Aeropuerto</City>
</Table>
<Table>
<Country>Spain</Country>
<City>La Palma/Aeropuerto</City>
</Table>
<Table>
<Country>Spain</Country>
<City>Las Palmas De Gran Canaria/Gando</City>
</Table>
<Table>
<Country>Spain</Country>
<City>Lanzarote/Aeropuerto</City>
</Table>
<Table>
<Country>Spain</Country'... (length=4383)
Я не уверен в вашем вопросе? вы хотите разбить строку на массив? – Sumit
Да в массив. как '' значения тега в одном массиве и '' в другом. –
'$ response-> GetCitiesByCountryResult' содержит эту строку XML. Используйте XML-парсер для его обработки. – Barmar