The functions of this favorite mobile phone information include getting mobile phone numbers, browser header information, obtaining mobile phone types, and obtaining mobile phone IP addresses.
The code is as follows: |
Copy code |
<? Php /** * Class name: mobile * Description: mobile phone information. * Others: accidental writing */
Class mobile { /** * Function name: getPhoneNumber * Function: obtains the mobile phone number. * Input parameter: none * Function return value: the number is returned successfully. If the function fails, false is returned. * Other instructions: Description */ Function getPhoneNumber (){ If (isset ($ _ SERVER ['http _ X_NETWORK_INFO ']) { $ Str1 = $ _ SERVER ['http _ X_NETWORK_INFO ']; $ Getstr1 = preg_replace ('/(. *,) (11 [d]) (,. *)/I', '2', $ str1 ); Return $ getstr1; } Elseif (isset ($ _ SERVER ['http _ X_UP_CALLING_LINE_ID ']) { $ Getstr2 = $ _ SERVER ['http _ X_UP_CALLING_LINE_ID ']; Return $ getstr2; } Elseif (isset ($ _ SERVER ['http _ x_up_subno']) { $ Str3 = $ _ SERVER ['http _ x_up_subno']; $ Getstr3 = preg_replace ('/(. *) (11 [d]) (. *)/I', '2', $ str3 ); Return $ getstr3; } Elseif (isset ($ _ SERVER ['deviceid']) { Return $ _ SERVER ['deviceid']; } Else { Return false; } }
/** * Function name: getHttpHeader * Function: obtains the header information. * Input parameter: none * Function return value: the number is returned successfully. If the function fails, false is returned. * Other instructions: Description */ Function getHttpHeader (){ $ Str = ''; Foreach ($ _ SERVER as $ key => $ val ){ $ Gstr = str_replace ("&", "&", $ val ); $ Str. = "$ key->". $ gstr. "rn "; } Return $ str; }
/** * Function name: getUA * Function: UA * Input parameter: none * Function return value: the number is returned successfully. If the function fails, false is returned. * Other instructions: Description */ Function getUA (){ If (isset ($ _ SERVER ['http _ USER_AGENT ']) { Return $ _ SERVER ['http _ USER_AGENT ']; } Else { Return false; } }
/** * Function name: getPhoneType * Function: obtains the mobile phone type. * Input parameter: none * Function return value: string is returned for success, and false is returned for failure. * Other instructions: Description */ Function getPhoneType (){ $ Ua = $ this-> getUA (); If ($ ua! = False ){ $ Str = explode ('', $ ua ); Return $ str [0]; } Else { Return false; } }
/** * Function name: isOpera * Function: determines whether it is opera. * Input parameter: none * Function return value: string is returned for success, and false is returned for failure. * Other instructions: Description */ Function isOpera (){ $ Uainfo = $ this-> getUA (); If (preg_match ('/. * Opera. */I', $ uainfo )){ Return true; } Else { Return false; } }
/** * Function name: ismreceivate * Function: determines whether it is mshortate. * Input parameter: none * Function return value: string is returned for success, and false is returned for failure. * Other instructions: Description */ Function ismreceivate (){ $ Uainfo = $ this-> getUA (); If (preg_match ('/mshortate/I', $ uainfo )){ Return true; } Else { Return false; } }
/** * Function name: getHttpAccept * Function: obtain the HA * Input parameter: none * Function return value: string is returned for success, and false is returned for failure. * Other instructions: Description */ Function getHttpAccept (){ If (isset ($ _ SERVER ['http _ ACCEPT ']) { Return $ _ SERVER ['http _ ACCEPT ']; } Else { Return false; } }
/** * Function name: getIP * Function: obtain the mobile IP address. * Input parameter: none * Function return value: string is returned successfully. * Other instructions: Description */ Function getIP (){ $ Ip = getenv ('remote _ ADDR '); $ Ip _ = getenv ('http _ X_FORWARDED_FOR '); If ($ ip _! = "") & ($ Ip _! = "Unknown ")){ $ Ip = $ ip _; } Return $ ip; } } ?> |