//Code written by Thomas Holmes - tom@51degrees.mobi //Enjoy! Web Service Test $_SERVER['HTTP_USER_AGENT'])); } catch(Exception $e) { //Something went wrong return $e->GetMessage(); } } //Returns a single capability as a string function GetCapability($capability) { try { //Obtains a SoapClients $client = GetSoapClient(); //Pass the service the parameter you want $params = array ('capability' => $capability); //Get the capability and then return it $result = $client->GetCapability($params); return $result->GetCapabilityResult; } catch(Exception $e) { //Something went wrong return $e->GetMessage(); } } //Takes a string array of capabilities and returns them in that order. //If a capability coudn't be found the service returns null for that element. function GetCapabilities($capabilities) { try { //Open SoapClient $client = GetSoapClient(); //Pass parameters $params = array ('capabilities' => $capabilities); $result = $client->GetCapabilities($params); //A multidimensional array object is returned. //Cast as array. $var = (array)$result->GetCapabilitiesResult; //Take the 'string' element. print_r($var); return $var[string]; } catch(Exception $e) { //Something went wrong. return $e->GetMessage(); } } echo 'Useragent of device: '; echo $_SERVER['HTTP_USER_AGENT']; echo '

'; echo 'Brand name of device: '; echo GetCapability('brand_name'); echo '

'; echo 'Model name of device: '; echo GetCapability('model_name'); echo '

'; $caps = GetCapabilities(array('brand_name', 'model_name')); echo 'Capabilities as an array:

'; foreach ($caps as $cap) { echo "$cap
"; } ?>