Created
May 11, 2017 21:43
-
-
Save Michaela-Davis/fdec6cf3d4de11db31c3ae88e37ac55c to your computer and use it in GitHub Desktop.
PHP / Drupal return api results in json format - line 9 - see drupal_cassette-store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WeatherController | |
{ | |
public function api() { | |
$city = 'Missoula'; | |
$state = 'MT'; | |
$weather = 'http://api.wunderground.com/api/28eb4ab328f37f10/conditions/q/' . $state . '/' . $city . '.json'; | |
// $apiKey = '28eb4ab328f37f10'; | |
$result = file_get_contents($weather); | |
$weather_array = json_decode($result, true); | |
return new response ($result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment