Fix spaces incorrectly used when fetching the city when wanted to add it

master
Loic Blot 2015-11-21 09:30:54 +01:00
parent 1fd97bf94f
commit 7affd7dc67
1 changed files with 1 additions and 0 deletions

View File

@ -106,6 +106,7 @@ class CityController extends Controller {
} }
private function getCityInformations ($name) { private function getCityInformations ($name) {
$name = preg_replace("[ ]",'%20',$name);
$cityDatas = json_decode(file_get_contents("http://api.openweathermap.org/data/2.5/forecast?q=$name&mode=json&APPID=".$this->apiKey), true); $cityDatas = json_decode(file_get_contents("http://api.openweathermap.org/data/2.5/forecast?q=$name&mode=json&APPID=".$this->apiKey), true);
if ($cityDatas['cod'] != '200') { if ($cityDatas['cod'] != '200') {
return null; return null;