开发者

Parsing certain information from an html page

I am trying to find a way to retrieve a users zip code based on their IP address. I would like to accomplish this without using a mas开发者_开发知识库sive database. I found this script to get the state by IP, however I need it to grab the zipcode, I tried modifying the parameters of the strip_tags, but no dice.

Here is what I have so far:

$ip =$_SERVER['REMOTE_ADDR'];
$a=file("http://www.geoiptool.com/en/?IP=$ip");
$zip=strip_tags($a[126]);
$zip=str_replace(" ","",$zip);

All help is appreciated! Thanks!


Isn't the Postal Code at index $a[134]?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜