一个IP获取的结果不是很完善,究其原因是因为ip138的IP解析应对国外的地址时不是很详细,所以又重新写了个用Chianz.com的代码,实例代码如下:
<!DOCTYPE html> <html lang="en"> <head> <title></title> <meta charset="UTF-8" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> //开源代码phprm.com <body> <?php $ipAddr = "4.4.44.4"; $ipChinazAddr = "http://tool.chinaz.com/IP/?IP=".$ipAddr; $contents = file_get_contents($ipChinazAddr); $pattern = "/==>>.+</strong><br />/"; $string = $contents; preg_match_all($pattern,$string,$addrArray); $num = count($addrArray[0]); $pattern = "/(==>>).+(==>>s)/"; for($i = 0;$i<$num;$i++){ $addrArray[0][$i] = preg_replace($pattern,"",$addrArray[0][$i]); } echo "<pre class="brush:php;toolbar:false">"; print_r($addrArray); echo "";
Statement
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
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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 agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
4 weeks agoByDDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
4 weeks agoByDDD
Two Point Museum: All Exhibits And Where To Find Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

WebStorm Mac version
Useful JavaScript development tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use
