when I try to get us file_get_contents to my weather, it shows me this error
What did I do wrong ??
Cant I just do:
<?php
function getWeather_PHP($location) {
$l_location = (string)$location;
$url = "http://api.openweathermap.org/data/2.5/weather?".$l_location."&lang=en&units=metric&appid=MY_API_KEY";
$url = (string)$url;
$contents = file_get_contents($url); //error occur here
...
return weather_data;
?>
And in a script in same php file
<script>
var inputString = "PLACE_LOCATION"
var php_result = "<?php
$php_inputString = '"+inputString+"';
echo getWeather_PHP($php_inputString);
?>";
</script>
And the Error is : enter image description here
another error report I got is
Warning: file_get_contents("+this_url+"): failed to open stream: No such file or directory in /opt/lampp/htdocs/Index.php on line 50
– M.H Sep 30 '18 at 23:24