API code for phpcurl to obtain all information of a specified IP address

Source: Internet
Author: User
API code for phpcurl to obtain all information of a specified IP address
This article describes how to use the curl function in php to obtain the API code of all information under the specified IP address. For more information, see.

Share The api code that uses curl to retrieve all information under the specified IP address. For curl-related content, refer to the following articles: php curl simple example of uploading files php curl post simple example php curl application instance analysis php curl usage instance code php use curl to determine whether a remote file exists php use curl to forge IP source php curl learning summary first charging, then read the following code. The code is as follows:

     True,); curl_setopt_array ($ ch, $ options); $ res = curl_exec ($ ch); curl_close ($ ch); if ($ xml = simplexml_load_string ($ res )) {$ dt = array (); foreach ($ xml-> Location-> children () as $ key => $ item) {$ dt [$ key] = strtolower ($ item);} return $ dt;} else {return false ;}$ current_Ip_Info = getIpInfo ('61. 164.140.55'); var_dump ($ current_Ip_Info);/* returned content: array (13) {["Ip"] => string (13) "61.164.140.55" ["Status"] => String (2) "OK" ["CountryCode"] => string (2) "cn" ["CountryName"] => string (5) "china" ["RegionCode"] => string (2) "02" ["RegionName"] => string (8) "zhejiang" ["City"] => string (5) "ruian" ["ZipPostalCode"] => string (0) "" ["Latitude"] => string (7) "27.7814" ["longpolling"] => string (7) & quot; 120.628 & quot; [& quot; TimezoneName & quot;] = & quot; string (14) & quot; asia/chongqing & quot; [& quot; Gmtoffset & quot;] = & quot; string (5) "28800" ["Isdst"] => string (1) "0 "}*/? >

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.