<a href="http://maps.apple.com/?ll=<?php echo $_GET[q] ?>" style="text-
decoration:none;color:gray;"><div class="box" style="position:absolute;top:0px;left:0px;font-family:Lato;"><span style="float:left;">Directions</span><span style="color:#F2473F;float:right;">About <?php
$lat = $_GET['lat'];
$long = $_GET['long'];
$q = $_GET['q'];
$mysongs = simplexml_load_file('http://www.mapquestapi.com/geocoding/v1/address?key=Fmjtd%7Cluuan1urn9%2Cb0%3Do5-968206&location=' . $q . '&callback=renderGeocode&format=xml');
$lat2 = $mysongs->results[0]->result[0]->result[0]->locations[0]->location[0]->latLng[0]->lat;
$long2 = $mysongs->results[0]->result[0]->result[0]->locations[0]->location[0]->latLng[0]->lng;
$mysongs4 = simplexml_load_file('http://www.mapquestapi.com/directions/v1/route?key=Fmjtd%7Cluuan1u2nh%2C2a%3Do5-96rw5u&from=' . $lat . ',' . $long . '&to=' . $lat2 . ',' . $long2 . '&callback=renderNarrative&outFormat=xml');
$vari = $mysongs4->route[0]->time;
$vari = $vari / 60;
echo round($vari);
?> minutes</span><br></div>
What did I do wrong? The variables $lat2 and $long2 are empty. When I print_r $mysongs, it says that the API key is wrong, which it isn't, and it returns a 403 error.
I'm pretty sure that this is a problem in the way I sent the URI in $mysongs, (cause I've had a similar problem before with the same API), but I'm not quite sure where.
The request I'm doing is ?q=19540 Jamboree Rd Ste 200 Irvine, CA&lat=33.852471&long=-117.7325256 .
Thanks you so much!