-3
<body>
<table align="center">
<?
$ip=$_SERVER['REMOTE_ADDR'];
$url=file_get_contents("http://whatismyipaddress.com/ip/$ip");
preg_match_all('/<th>(.*?)<\/th><td>(.*?)<\/td>/s',$url,$output,PREG_SET_ORDER);
for ($q=0; $q < 25; $q++) {
if ($output[$q][1]) {
if (!stripos($output[$q][2],"Blacklist")) {
echo "<tr><td>".$output[$q][1]."</td><td>".$output[$q][2]."</td></tr>";
}
}
}
?>
</table>
</body>
现在,有了这个代码,我得到了很多像ISP,国家信息等
如何提取内容以便将它们加载到我的数据库中,如$ country,$ isp等?我认为它可以做到,如果它被转换为XML,但我不知道。
你会给我一个小例子...示例代码...我不明白 – user889030 2012-01-03 18:33:28
哥们阅读我给出的链接有很多例子...阅读文档更多.. – 2012-01-03 18:35:51
http://simplehtmldom.sourceforge.net/manual.htm – 2012-01-03 18:36:52