开发者

Parsing certain information from an html page

开发者 https://www.devze.com 2023-02-08 11:09 出处:网络
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 stat

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

精彩评论

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