getMobileDevice
This function is an advanced version of
isMobileDevice. Use this function to determine whether the device is a mobile device and also receive the model and manufacturer of the device.
Parameters:
- devKey - used for authentication and to log usage.
- headers - the headers of the device you wish to query.
Returns: (string)
Upon success, XML containing mobile device information
Upon failure, error codes WAPL markup
PHP Example
Nb. The example below uses the native PHP soap extension in PHP. The code is for demonstration purposes only and should be modified for use in a production environment.
- <?php
-
- $headers = '';
- foreach($_SERVER as $key => $val)
- {
- $headers .= $key.':'.$val.'|';
- }
-
- $postfields = array(
- 'devKey' => 'YOUR_DEV_KEY',
- 'headers' => $headers
- );
-
- $c = curl_init();
- curl_setopt($c, CURLOPT_URL, 'http://webservices.wapple.net/getMobileDevice.php');
- curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($c, CURLOPT_POST, 1);
- curl_setopt($c, CURLOPT_POSTFIELDS, $postfields);
-
- $result = curl_exec($c);
- $xml = simplexml_load_string($result);
- curl_close($c);
-
- if (trim($xml->mobile_device) == 1)
- {
- echo '<pre>';
- echo 'I AM A MOBILE DEVICE'."\n";
- echo 'Manufacturer: '.trim($xml->manufacturer)."\n";
- echo 'Model: '.trim($xml->model)."\n";
- echo '</pre>';
- } else
- {
- $isMobile = false;
- }
- ?>