I have the following URL : http://localhost:8000/PHPTrialProject/showPlace.php?lat=28.6139391&lng=77.20902120000005
I have extracted the query string from this and stored in two PHP variables :
$latitude=$_GET['lat'];
$longitude=$_GET['lng'];
echo("latitude is : ".$latitude);
echo("longitude is : ".$longitude);
I then append them to my next URL and try to load it into DOMDocument. I tried two ways :
$url="http://api.openweathermap.org/data/2.5/weather?lat=".$latitude."&lon=".$longitude;
$xml3 = $url;
$xmlDoc3 = new DOMDocument();
$xmlDoc3->load($xml3);
and
$xml3 = ("http://api.openweathermap.org/data/2.5/weather?lat=".$latitude."&lon=".$longitude);
$xmlDoc3 = new DOMDocument();
$xmlDoc3->load($xml3);
However, both of them give me the following error :
Warning: DOMDocument::load(): Start tag expected, '<' not found in http://api.openweathermap.org/data/2.5/weather?lat=28.6139391&lon=77.20902120000005, line: 1 in C:\xampp\htdocs\PHPTrialProject\showPlace.php on line 98
How do I resolve it?