PHP file_get_contents issue

  • 1
  • Question
  • Updated 7 years ago

I've successfully fetched and parsed the JSON station information returned from this function call:


I'm now trying to pass the parsed state (assigned to $closest_state) and city ($closest_city) to the observation URL:


The browser returns the following error:

Warning: file_get_contents( Pass.json) [function.file-get-contents]: failed to open stream: No such file or directory in C:\wamp\www\test\wunderground-tab.php on line 22

When I copy and paste the URL displayed in the error directly into the browser, the JSON is returned and visible in the browser window.

I'm thinking that the lack of forcing an http call is somehow involved in the problem but I'm not sure how to get around that.

Thanks in advanced!

Rick R.
Photo of Rick Rose

Rick Rose

  • 1 Post
  • 0 Reply Likes

Posted 7 years ago

  • 1
Photo of afelicioni


  • 227 Posts
  • 43 Reply Likes
It seems that a "http://" is missing from the beginning of the string passed to file_get_contents, so even the http wrapper is not triggered.