IOS 通过描述获取UDID PHP代码版

难点在于PHP对XML的解析

文件结构:
IOS 通过描述获取UDID PHP代码版_第1张图片

第一步:新建HTML文件 用于跳转安装描述文件 必须在safari里面打开地址





 
获取您的UDID




第二步:新建udid.mobileconfig文件




    
        PayloadContent
        
            URL
            https://www.xxx.com/pay_super/receive.php 
            DeviceAttributes
            
                UDID
                IMEI
                ICCID
                VERSION
                PRODUCT
            
        
        PayloadOrganization
        dev.skyfox.org  
        PayloadDisplayName
        查询设备UDID  
        PayloadVersion
        1
        PayloadUUID
        3C4DC7D2-E475-3375-489C-0BB8D737A653  
        PayloadIdentifier
        dev.skyfox.profile-service
        PayloadDescription
        本文件仅用来获取设备ID   
        PayloadType
        Profile Service
    

第三步:新建receive.php,用来接收回调的xml数组。
IOS 通过描述获取UDID PHP代码版_第2张图片用来

';

$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);
xml_parser_free($xml);

$UDID = "";
$CHALLENGE = "";
$DEVICE_NAME = "";
$DEVICE_PRODUCT = "";
$DEVICE_VERSION = "";
$iterator = 0;

$arrayCleaned = array();

foreach($vs as $v){

if($v['level'] == 3 && $v['type'] == 'complete'){
$arrayCleaned[]= $v;
}
$iterator++;
}

$data = "";

$iterator = 0;

foreach($arrayCleaned as $elem){
$data .= "\n==".$elem['tag']." -> ".$elem['value']."
"; switch ($elem['value']) { case "CHALLENGE": $CHALLENGE = $arrayCleaned[$iterator+1]['value']; break; case "DEVICE_NAME": $DEVICE_NAME = $arrayCleaned[$iterator+1]['value']; break; case "PRODUCT": $DEVICE_PRODUCT = $arrayCleaned[$iterator+1]['value']; break; case "UDID": $UDID = $arrayCleaned[$iterator+1]['value']; break; case "VERSION": $DEVICE_VERSION = $arrayCleaned[$iterator+1]['value']; break; } $iterator++; } $params = "uid=".$uid."&UDID=".$UDID."&CHALLENGE=".$CHALLENGE."&DEVICE_NAME=".$DEVICE_NAME."&DEVICE_PRODUCT=".$DEVICE_PRODUCT."&DEVICE_VERSION=".$DEVICE_VERSION; header('HTTP/1.1 301 Moved Permanently'); //这里一定要301跳转,否则设备安装会提示"无效的描述文件" header("Location: http://yutang.8090.com/pay_super/location.php?".$params);

第四步:创建跳转打印udid的文件(location.php)



UDID: 

你可能感兴趣的:(IOS,PHP)