How to determine iPhone UC Browser in php

Source: Internet
Author: User
In php, how does one determine the iPhone version's UC Browser? The following can be judged, but there is a problem: The ios UC browser has a high speed mode, and it cannot be determined if it switches to the high speed mode. Now I want to determine whether to jump to the UC Browser separately. $ UserAgent & nbsp; = & nbsp; $ _ SERVER ['http _ USER_AG: How does php determine the iPhone version of UC Browser?
The following can be judged, but there is a problem: The ios UC browser has a high speed mode, and it cannot be determined if it switches to the high speed mode. Now I want to determine whether to jump to the UC Browser separately.

$userAgent = $_SERVER['HTTP_USER_AGENT'];
if(strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod")){
    header("location:http://www.baidu.com");
}else if(strpos($userAgent,"Android")){
    header("location:http://www.google.com");
}

------ Solution --------------------
Echo $ _ SERVER ['http _ USER_AGENT '];

Post result
------ Solution --------------------
Enter the result as the moderator. Try IUC characters
------ Solution --------------------
A few years ago, you were thinking about similar issues.

Judging the iPhone version of UC... probably means you are working on a software station or an advertisement page...

Whether it's UC or safari... it's not a hundred percent that can be captured to get UA.

I cannot recall it now, but there are several ideas that may help you.
1. some versions of UC browsers have different IP addresses for the first access and the second access, which is generally considered to be a problem in browser settings. UC generally enables transfer or web compression in the software settings by default. safari or other mobile browsers do not have this problem. you can use redirection (not Page 301), which is a delayed jump in JS or wml. different IP addresses can be obtained. you can perform the test on your own.

2. most UC browsers enable proxy and other settings by default. the speed mode you mentioned is probably similar to the proxy. the Accessed IP address is inconsistent with the IP address under the CMWAP, CMNET, or WIFI link of the mobile phone (available for comparison with the browser), most of which are IP addresses in Guangdong, Beijing, and other regions, I recall that it was the IP address of the UC transit server. you can make a data table to record these IP addresses. if these IP addresses are used for access, you can basically identify them as UC browsers.

3. the accuracy determined by UA is very low. if the precision requirement for development is high, the written logic cannot be too simple. not just UA. you can also use HTTP_X_NETWORK_INFO, HTTP_X_UP_CALLING_LINE_ID, DEVICEID, HTTP_X_UP_SUBNO, HTTP_VIA, and so on.

Hope to help you.
------ Solution --------------------
It seems that UC has a proxy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.