api retrieving a null result

  • 1
  • Problem
  • Updated 2 years ago
My hosting service experienced a disk failure and they had to manually restore my site on a new server. Ever since my weather api has been retrieving a NULL result.

I have updated/regenerated a new api key but this does not solve the problem. The station is reporting as I am getting a result for another site and api key.

Any suggestions on fixing this?
Photo of Bill Myers

Bill Myers

  • 8 Posts
  • 1 Reply Like

Posted 2 years ago

  • 1
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 123 Reply Likes
What is the URL you're hitting, without your API key in the URL?
Photo of Bill Myers

Bill Myers

  • 8 Posts
  • 1 Reply Like
Not sure what you're asking for here. Site is Smithersgolfclub.com for the town of Smithers.
Photo of Bill Myers

Bill Myers

  • 8 Posts
  • 1 Reply Like
Here's the line of code
$json_string = file_get_contents("http://api.wunderground.com/api/[api here]/geolookup/conditions/forecast/astronomy/almanac/q/Canada/Smithers.json"); # smithersgolfclub.com weather api key
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 123 Reply Likes
When I put my API key in the same URL the data returns fine.  There might be an issue in how your code is rendering the data on your page.
Photo of Bill Myers

Bill Myers

  • 8 Posts
  • 1 Reply Like
I know the line if code is correct as I did the same thing you did. I thought it might have had something to do with the site changing nameservers? I'll go to the hosting company and see what they say