Cuelogic Blog Icon
Cuelogic Career Icon
Home > Blog > All > Getting an iPhone UDID from Mobile Safari

Getting an iPhone UDID from Mobile Safari

There are four step to get UDID

1) Create .mobileconfig XML file for your website

2) When you hit/click .mobileconfig XML url. This pull up their provisioning settings on their phone & offers them an ‘Install’ button

3)The phone sends the data you requested in encrypted XML to the URL you set in your .mobileconfig

4) Process xml data and you will get UDID

1) Create .mobileconifg

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string> Mobile Web App</string>
<string>sitename Profile</string>
<string>By installing this profile, you'll allow sitename's mobile web app to know the UDID of your device and find apps available for installation on www.sitename.come/mobile
Only the UDID of your device will be transmitted to sitename. Nothing will be installed on the device.</string>
<string>Profile Service</string>

You’ll need to fill in your own URL and PayloadUUID. The PayloadUUID doesn’t have to be generated in a special way – just make sure it is unique to your app.

2) The User Views Your Provision Profile

PayloadOrganization and PayloadDescription are shown to the user when they see the profile. In my description
You don’t have to sign your .mobileconfig, but if you don’t then they will see a warning that it is not signed (see below).

Install profile image
Install profile image

3) Receiving the Requested Data

You will be redirected info.php page . add below code in this file

 $data = file_get_contents('php://input');

$plistBegin   = '<?xml version="1.0"';
$plistEnd   = '</plist>';
$pos1 = strpos($data, $plistBegin);
$pos2 = strpos($data, $plistEnd);
$data2 = substr ($data,$pos1,$pos2-$pos1);
$xml = xml_parser_create();
xml_parse_into_struct($xml, $data2, $vs);

$UDID = "";
$iterator = 0;

$arrayCleaned = array();
foreach($vs as $v){
if($v['level'] == 3 && $v['type'] == 'complete'){
$arrayCleaned[]= $v;

$data = "";
$iterator = 0;

foreach($arrayCleaned as $elem){

$data .= "\n==".$elem['tag']." -> ".$elem['value']."<br/>";

switch ($elem['value']) {


$CHALLENGE = $arrayCleaned[$iterator+1]['value'];



$DEVICE_NAME = $arrayCleaned[$iterator+1]['value'];


case "PRODUCT":

$DEVICE_PRODUCT = $arrayCleaned[$iterator+1]['value'];


case "UDID":

$UDID = $arrayCleaned[$iterator+1]['value'];


case "VERSION":

$DEVICE_VERSION = $arrayCleaned[$iterator+1]['value'];



// result_data is a directory


4) Get Data

Note – “result_data” is a directory and not a page, I have created index.php in this page I get data in $_GET.
If you used script page insted of result data directory then it will give invalid profile while installing profile