Based on thinkphp, you can determine the geographical location based on your ip address and provide the corresponding weather information. Thinkphp-based applications that determine geographical locations based on users' ip addresses and provide
DAT files, information files about IP-corresponding areas
Qqwry.dat file
Download yourself Online
class file, parsing the Qqwry.data file's
iplocation.php File
Copy Code code as follows:
Class Iplocation {
/**
* @var Resource pointer
Based on the thinkphp, the application of the geographical location and the corresponding weather information according to the user IP
We all know that in a lot of sites provide users with the ability to provide weather forecasts, and sometimes
Because my website needs to query the source IP address to query its geographical location information. Therefore, I used some things to query geographical location information based on IP addresses, and now I have shared some accumulated things in
/// ///provide the method of searching IP information from the pure IP database;/// Public classIpselect {FileStream ipfile; LongIP; Public stringIpfilepath; /// ///constructor Function/// ///Pure IP Database path
We all know that many websites offer the ability to provide weather forecasts to users, and sometimes find that the same site can judge geographic location and display weather information, even if the user does not enter any information about their
Yesterday has completed an "ASP." Based on the IP return corresponding location information of the small demo, since the location information can be obtained through the IP, it can certainly be obtained by the latitude and longitude of the location
PHP installation of GeoIP extension based on the IP address to obtain the geographic location and calculation distance method, geoip geographic location
Obtain the visitor's country, city, and latitude and longitude Based on the IP addressInstall
The major websites are provided according to the IP to obtain the user's geographical location information, here to Sina's interface as an exampleThe interface address is: http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=218.18.171.146
In Web applications, locating and logging related access logs based on IP addresses is also a common requirement, and in thinkphp you can easily implement IP address acquisition and positioning
You can download the IP Location Extension class
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.