tags:

views:

132

answers:

1
+1  A: 

The documentation page of Net_Geo::Net_Geo() says that :

The method accepts two parameters :

bool Net_Geo() ( string $applicationName = '' , string $alternateServerUrl = '' )

And those parameters are :

  • string $applicationName - Optional application name to use in UserAgent when polling Netgeo
  • string $alternateServerUrl - URL to Netgeo service script, will be set to "http://netgeo.caida.org/perl/netgeo.cgi" unless changed

You are not passing any of those parameters -- which means the default Netgeo service URL is used...

... And if you try to open it ( http://netgeo.caida.org/perl/netgeo.cgi ), you'll see it doesn't work ; my Firefox says it cannot connect to the server.

This probably explains why your code doesn't produce any expected output : if it relies on a geolocalition server, and that server doesn't work anymore...


As a sidenote : according to the index of pear packages in the Networking section, Net_Geo is not maintained anymore, and the last version was released in 2006-03-29 ; which is quite not a good sign...

If you can install PECL packages (you'll probably need to be admin of your server), maybe the GeoIP package would interest you.

Pascal MARTIN
thanks for the answers.But what are the parameters should I pass to "applicationName" and "alternateServerUrl"
Biranchi
YOu're welcome about the anser ;; sorry, I have absolutly no idea about what values you should use ;; I myself would probably not use that package, actually (it's quite old, it's not maintained since a long time, it generates a lot of notices, ...)
Pascal MARTIN