Different JSON data being returned based on language being used (JavaScript vs PHP)

  • 1
  • Question
  • Updated 4 years ago
I'm getting some really weird behaviour from the results the API is returning.

This is the URL I'm using to get JSON data: http://api.wunderground.com/api/xxxxA...

When I use this in Javascript, I'm getting the proper values (i.e. the conditions of the city I'm currently in based on the IP is being detected). However, when I use it in PHP, I'm getting a completely different city. Why is this happening?
Photo of geoffl

geoffl

  • 11 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of John Belmonte

John Belmonte

  • 18 Posts
  • 1 Reply Like
Does the "completely different city" just happen to be where the server is located?
Photo of geoffl

geoffl

  • 11 Posts
  • 0 Reply Likes
Yeah, I think it is. I looked into it a little more, and when I run the PHP on my local machine, the response returns information about my city. Thanks for the help!