Home Backend Development PHP Tutorial Taobao IP address query class sharing (using Taobao IP library)_PHP tutorial

Taobao IP address query class sharing (using Taobao IP library)_PHP tutorial

Jul 13, 2016 am 10:41 AM
http company share use Address query geographical information Library interface supply Inquire Taobao use kind

Taobao provides a very useful IP geographic information query interface. Here: http://ip.taobao.com/

The following taobaoIPQuery class will greatly simplify related information query.

Copy code The code is as follows:


class taobaoIPQuery {

private $m_ip;
private $m_content;

public function __construct($ip) {
if (isset($ip)) {
$this->m_ip = $ip : () ;
       curl_setopt($url_handle, CURLOPT_URL, "http://ip.taobao.com/service/getIpInfo.php?ip=" . $this->m_ip);
        curl_setopt($url_handle, CURLOPT_RETURNTRANSFER, true);
$this->m_content = curl_exec($url_handle);
curl_close($url_handle);
if ($this->m_content) {
$ this->m_content = json_decode($this->m_content);
if ($this->m_content->{'code'} == 1) {
exit("query error!");
} } Else {
EXIT ("Curl E error!"); 🎜> }

public function get_region() {
return $this->m_content->{'data'}->{'region'};
}

public function get_isp() {
return $this->m_content->{'data'}->{'isp'};
}

public function get_country() { Return $ this-& gt; m_content- & gt; {'data'}-& gt; {'country'};


Public function get_city () {
Return $ this ->m_content->{'data'}->{'city'};
}

}



The call is very simple




Copy code

The code is as follows:

$ip = $_SERVER["REMOTE_ADDR"];$ipquery = new taobaoIPQuery($ip);

$region = $ipquery->get_region();

$country = $ipquery->get_country();

$city = $ipquery->get_city() ;

http://www.bkjia.com/PHPjc/676912.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/676912.html
TechArticle

Taobao provides a very useful IP geographical information query interface. Here: http://ip.taobao.com/ The following taobaoIPQuery class will greatly simplify related information query. Copy code...

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to get Taobao free red envelope 2024 How to get Taobao free red envelope 2024 May 09, 2024 pm 03:22 PM

The 2024 Taobao free order event will be held three times a day. Everyone needs to place an order and pay for the corresponding amount of goods at the corresponding time. The free order amount will be distributed in the form of red envelopes of equal amounts. Next, we will bring you how to receive the Taobao free order red envelope in 2024: grab it For users who are free of charge, the red envelope qualification will be issued to the card and coupon package, which is in a state of activation; the web version of Taobao currently does not have the card and coupon package, and only displays the winning records of the free order event; the card and coupon package is in [Taobao APP-My Taobao] -My Rights-Red Envelope]. How to get red envelopes for free orders on Taobao 20241. For users who grab free orders, the red envelope qualifications will be distributed to the card and coupon packages, which are in a state of waiting for activation; 2. The web version of Taobao currently does not have card and coupon packages, and only displays the winning records of the free order activities. ;3. The card coupon package is in [Taobao APP-My Taobao-My Rights-Red Envelope]

How to check your academic qualifications on Xuexin.com How to check your academic qualifications on Xuexin.com Mar 28, 2024 pm 04:31 PM

How to check my academic qualifications on Xuexin.com? You can check your academic qualifications on Xuexin.com, but many users don’t know how to check their academic qualifications on Xuexin.com. Next, the editor brings you a graphic tutorial on how to check your academic qualifications on Xuexin.com. Interested users come and take a look! Xuexin.com usage tutorial: How to check your academic qualifications on Xuexin.com 1. Xuexin.com entrance: https://www.chsi.com.cn/ 2. Website query: Step 1: Click on the Xuexin.com address above to enter the homepage Click [Education Query]; Step 2: On the latest webpage, click [Query] as shown by the arrow in the figure below; Step 3: Then click [Login Academic Credit File] on the new page; Step 4: On the login page Enter the information and click [Login];

12306 How to check historical ticket purchase records How to check historical ticket purchase records 12306 How to check historical ticket purchase records How to check historical ticket purchase records Mar 28, 2024 pm 03:11 PM

Download the latest version of 12306 ticket booking app. It is a travel ticket purchasing software that everyone is very satisfied with. It is very convenient to go wherever you want. There are many ticket sources provided in the software. You only need to pass real-name authentication to purchase tickets online. All users You can easily buy travel tickets and air tickets and enjoy different discounts. You can also start booking reservations in advance to grab tickets. You can book hotels or special car transfers. With it, you can go where you want to go and buy tickets with one click. Traveling is simpler and more convenient, making everyone's travel experience more comfortable. Now the editor details it online Provides 12306 users with a way to view historical ticket purchase records. 1. Open Railway 12306, click My in the lower right corner, and click My Order 2. Click Paid on the order page. 3. On the paid page

How to turn off red envelope reminder on Taobao How to turn off red envelope reminder on Taobao Apr 01, 2024 pm 06:25 PM

Taobao is a commonly used online shopping software for many friends. You usually place orders and purchase many things from Taobao. It provides users with a red envelope reminder function. Some friends want to turn it off, so hurry up and check out the PHP Chinese website. Take a look. List of steps to turn off red envelope reminders on Taobao 1. Open the personal center of Taobao APP and select the [Settings] button to enter the page. 2. Find the [Message Notification] option. Here you can select the message push switch. Find the red envelope message and turn off the switch. 3. Or you can turn off the notification permission of Taobao APP through the settings page of your mobile phone, so that all messages from Taobao will not enter the push and can only be seen after turning it on. 4. Users can set what types of messages they want to receive, which makes it easier to use.

Will 'Taobao' free red envelope refunds be returned? Will 'Taobao' free red envelope refunds be returned? May 08, 2024 am 08:16 AM

When shopping on Taobao, we often use free red envelopes to enjoy discounts. But if we need a refund, will these free red envelopes be returned? Let's take a look at the answer to this question. Will Taobao's free red envelopes be refunded? Depending on the situation, when you receive a red envelope, the red envelope is in a pending activation state. Before redeeming the product, the to-be-activated red envelope is not activated and cannot be used temporarily. You will wait until receipt of the purchased goods is confirmed. , the red envelope that needs to be activated can be used. If there is a problem with the product after using the free red envelope and it needs to be returned, the return of the red envelope needs to be judged according to the actual situation: 1. Refund Rules 11. If a refund occurs after the red envelope is used, the red envelope will be returned in proportion. 2. If the red envelope is not overdue, the period of use of the returned red envelope is the original period of use. If it is overdue, it will be issued within 7 days.

How to use 'Taobao' 510 free red envelope How to use 'Taobao' 510 free red envelope May 08, 2024 pm 10:00 PM

How to use Taobao 510 free red envelope? Taobao recently launched a free order event to celebrate its 510th anniversary. This event allows you to get free order red envelopes, and there are many benefits. I believe many friends want to participate in this event. Some friends have already received free order red envelopes, but they are not. If you know the specific usage, let’s take a look at the relevant introduction today. Instructions for using Taobao’s 510th Anniversary Free Order Red Packet: The free order red pack can be used after all orders placed for guessing questions have been confirmed and received. 1. Users can issue and recover free red envelopes through the web version of Taobao. Currently, there is no card and coupon package, but it can be viewed at [Taobao APP-My Taobao-My Rights-Red Envelopes]. For users who grab the free order, the red envelope qualification will be distributed to the card and coupon package, which is in a state of activation; the card and coupon package is in progress for winning prizes.

Taobao Big Winner March 31: In the Tang Dynasty, people could still call their father ' Taobao Big Winner March 31: In the Tang Dynasty, people could still call their father ' Mar 31, 2024 pm 12:11 PM

Taobao Winner’s March 31 question: In the Tang Dynasty, what could people still call their father? Many users don’t know what they could call their father in the Tang Dynasty? Then the editor will bring you the 3.31 Taobao Winner Daily I guess today’s answer is shared, if you are interested, come and find out. Taobao Daily Guess Answers Taobao Big Winner March 31: In the Tang Dynasty, could people still call their father? Question: In the Tang Dynasty, could people still call their father? Answer: B. Brother’s answer analysis: 1. Click here to find clues. You can find the answer to the question on the page as shown below; 2. People in the Tang Dynasty can call their father brother. In "Old Book of Tang·Biography of Wang Ju", "Xuanzong said: The fourth brother is benevolent and filial"; 3. The "fourth brother" here refers to Xuanzong's father, Ruizong, was at the same time

How to implement HTTP streaming using C++? How to implement HTTP streaming using C++? May 31, 2024 am 11:06 AM

How to implement HTTP streaming in C++? Create an SSL stream socket using Boost.Asio and the asiohttps client library. Connect to the server and send an HTTP request. Receive HTTP response headers and print them. Receives the HTTP response body and prints it.

See all articles