Get geo-location information by the principles and procedures
In the public service number development requirements often have access to user location information function, through the user's location information, can do some map navigation, and based on LBS marketing activities.
The following is to introduce the service number to obtain the User location information principles and procedures.
Principle
1. Location Information Acquisition process
2. Location information messages
gh_public_member_account
oNEGGwGfl8f5xMEqVHToL63LDL40
1444035882
28.701618 event
LOCATION
115.818817
30.000000
Parameter description:
parameter |
description |
tousername |
developer number |
fromusername |
Sender account (one OpenID) |
createtime |
message creation time (integral type) |
msgtype |
message type, event |
event |
event type, location |
latitude |
geographic latitude |
longitude |
geographic longitude |
Precision |
Location accuracy |
Get location Information step
1. Application for service number certification
Access to advanced services can only be obtained if the service number is certified.
2. Turn on the user location information acquisition function
Developer Center, get the user's location
3. weiphp location information message processing.
1. Configure the Service number development interface
The server will push the interaction between the user and the event message through this interface to the SP server.
2. Process the location message in the Weixincontroller indexaction.
Convert the XML message into a PHP array, and then remove the latitude and longitude information for use.
$content = file_get_contents (' php://input '); $data = new \simplexmlelement ($content); foreach ($data as $key + = $v Alue) {$this->data [$key] = Strval ($value);} To use data["longitude"]; data["Latitude"].
The above through the text and graphics to show you how to obtain the user's geographical location information principles and procedures, I hope you like.
http://www.bkjia.com/PHPjc/1071234.html www.bkjia.com true http://www.bkjia.com/PHPjc/1071234.html techarticle the principle and procedure of obtaining the location information of the user, obtaining the location of the information in the development of the public service number often has the function of obtaining the user's location, through the user's location letter ...