The development of micro message message interface public platform (31) micro me

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

Micro message public platform for the development of micro message public platform developer micro message public platform development model micro message browser   HTTP_USER_AGENT
Author: Fang times studio  

In the development process of micro message public platform, we sometimes need to develop webpage and determine whether it is from the micro message browser access, this paper introduces how to make this judgement.

A, $_SERVER array

$_SERVER Is a includes such as the header information (header), path (path), and script position (script locations) array and so on information. The array of items created by the Web server. Can not guarantee that each server is to provide all of the project; the server may ignore some, or provide some not listed here in the project.

In the   $_SERVER , you may be able to, may not be able to find these elements. Note, if you run PHP from the command line, below is a list of elements almost no effective (or are not of any practical significance).

'PHP_SELF'The script file name, Associated with document root. For example, In the address  use   script; $_SERVER['PHP_SELF']  will be /test.php/ __FILE__  constant current (such as including) contains the full path and file name of the file. Starting from the PHP version of 4.3.0  , If the PHP command line mode to run, This variable contains the name of the script. Previous versions of this variable is not available. An array of'argv'parameter passed to the script. When the script from the command line operation, The argv variable is passed to the C programming language style command line parameters. When the GET method is called, This variable contains the query string. 'argc'contains the number of command line mode of the arguments passed to the script (if in command line mode). CGI version used by the'GATEWAY_INTERFACE'server; for example, “ CGI/1.1”. 'SERVER_ADDR'is currently running script is the IP address of the server. The host name'SERVER_NAME'is currently running the script in the server. If the script is running on a virtual host, The name is provided by the virtual host value. 'SERVER_SOFTWARE'server identifies a string, Give in response to request headers. The name and version of the'SERVER_PROTOCOL'page request protocol. For example, “ HTTP/1.0”. 'REQUEST_METHOD'access request method used on the page; for example, “ GET” HEAD&rdquo, “, “ POST”, “ PUT”'REQUEST_TIME'request timestamp at the start of. Available from the PHP 5.1.0. 'REQUEST_TIME_FLOAT'request timestamp at the start of, Microsecond level accuracy. Since the PHP 5.4.0 began to take effect. 'QUERY_STRING'query string (query string), If any, Pages accessed through it. 'DOCUMENT_ROOT'is currently running the document root directory script is. Defined on the server configuration file. The current'HTTP_ACCEPT'request headers in   Accept:  the content of, If exists. The current'HTTP_ACCEPT_CHARSET'request headers in   Accept-Charset:  the content of, If exists. For example: iso-8859-1, “ *, utf-8”. The current'HTTP_ACCEPT_ENCODING'request headers in   Accept-Encoding:  the content of, If exists. For example: “ gzip”. The current'HTTP_ACCEPT_LANGUAGE'request headers in   Accept-Language:  the content of, If exists. For example: “ en”. The current'HTTP_CONNECTION'request headers in   Connection:  the content of, If exists. For example: “ Keep-Alive”. The current'HTTP_HOST'request headers in   Host:  the content of, If exists. 'HTTP_REFERER'guides the user agent to the address of a page of the current page (if it exists). The decision by user agent settings. Not all user agents will set the, Some also provides a modified   HTTP_REFERER  function. In short, This value is not credible. The current'HTTP_USER_AGENT'request headers in   User-Agent:  the content of, If exists. The string that the user agent information access this page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). 'HTTPS'if the script is accessed through the HTTPS protocol, Is set to a non empty value. 'REMOTE_ADDR'browse the current page the user's IP address. The host name of the current page user'REMOTE_HOST'browser. Reverse DNS analysis does not depend on the user's   REMOTE_ADDR. Port number for the'REMOTE_PORT'user machine to connect to the Web server using. 'REMOTE_USER'the user'REDIRECT_REMOTE_USER' authentication of users, If the request is in the internal redirection. 'SCRIPT_FILENAME'

The absolute path to the script execution

'SERVER_ADMIN'The SERVER_ADMIN parameter of the Apache server configuration file in the value. If the script is running on a virtual host, This value is the value of the virtual host. The'SERVER_PORT'Web server using the port. The default value is “ 80”. If you use a SSL connection, This value is set for a user HTTP port. 'SERVER_SIGNATURE'contains a string server version and the virtual host name. 'PATH_TRANSLATED'the current script where the file system (non document root directory) of the basic path. This is virtual to real path on server mapping results. The path to the'SCRIPT_NAME'contains the current script. This needs to be very useful in the page pointing to himself. __FILE__  constant that contains the current script (such as file containing the full path and file name). 'REQUEST_URI'URI is used to specify the page. For example, “ /index.html”. 'PHP_AUTH_DIGEST'as a Apache module operation, The process of HTTP certification of Digest, This variable is set to the client sends “ Authorization” HTTP header content (for further authentication operation). 'PHP_AUTH_USER'when PHP is running in Apache or IIS (PHP 5 ISAPI) module mode, And are using HTTP authentication, This variable is user input user name. 'PHP_AUTH_PW'when PHP is running in Apache or IIS (PHP 5 ISAPI) module mode, And are using HTTP authentication, This variable is the password entered by the user. 'AUTH_TYPE'when PHP is running in the Apache module mode, And are using HTTP authentication, This variable is set to the authentication type. 'PATH_INFO'contains provided by the client, following the script name and reality in the query (query string) path information before, If exists. For example, If the current script by URL foo=bar  be accessed?,   $_SERVER['PATH_INFO']  /some/stuff will contain  . 'ORIG_PATH_INFO'before PHP treatment, The original version of “ PATH_INFO”.

Two, access to HTTP_USER_AGENT

The following methods can be obtained


In iPhone, return

Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B176 MicroMessenger/4.3.2

In Android, return

Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255

Can see, micro message browser for   MicroMessenger  , followed by the version number of
at the same time, can also be used to determine the mobile phone type is iPhone or Android

Three, determine the micro message browser

We determine whether there is a MicroMessenger to HTTP_USER_AGENT



Welcome to pay attention to times the studio micro message, the newest information and Industry

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Chester at October 23, 2013 - 10:27 PM