Auto IP Delivers Host Server IP, rather than Client IP

  • 2
  • Problem
  • Updated 6 years ago
I am using JSON API under the Stratus plan to deliver weather information with the auto.ip address location. Rather than delivering the client ip address for a particular location, auto.ip delivers the location of my host server.

Is there a fix for this bug?

Also, I am not getting the 3 day forecast under my plan, just current conditions.

It would really be nice to see some sample source code to parse the XML for stratus before upgrading
Photo of webdev12

webdev12

  • 2 Posts
  • 0 Reply Likes
  • a bit disappointed but hey, such as life.

Posted 6 years ago

  • 2
Photo of vancew

vancew

  • 9 Posts
  • 0 Reply Likes
Let me guess, your using PHP or some sort of server code (ColdFusion, Ruby, Python) to get the JSON/XML feed?

If so then weather underground doesn't have a bug. They ARE going off the IP supplied, but because YOUR server is requesting the information, then you are getting weather for your servers ip address.

Use a language like Javascript, or other client side language (Actionscript, Java applet, etc) to request the JSON or XML feed.

Good Luck
Photo of webdev12

webdev12

  • 2 Posts
  • 0 Reply Likes
Vancew welcome to the community. Very benevolent of you to answer
some of the unanswered posts in this forum. Thanks for your help. Bravo! Yes, I was using PHP to get the JSON feed. I was looking into using the IP-based data sets to resolve for geo-location lookups.with javascript. I haven't implemented it yet because of problems with errors. If you have any sample code you could pass on, it would go a long way in helping me (and others I'm sure) move forward.
Photo of vancew

vancew

  • 9 Posts
  • 0 Reply Likes
Not a problem man. I highly suggest using a Javascript framework/codebase such as Jquery. Your basic steps are going to be:

1) make an http request (get request) to wunderground api
2) javascript can easily put the json request into a nice little object, inside a custom defined function. This is where you can use the information. Look into the 'onSuccess' or similiar functions of the http request.
3) display the info. I usually use something like a blank p tag or otherwise like so:

$('p.weather').html("Temp:" + tempf + "F");


Try these links, see if they help:
http://api.jquery.com/jQuery.get/ - notice the dataType param, that will allow you to automatically have jquery parse the json on success. I believe they call it 'jsonp' for the param to supply.

Hope that helps!