Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9031209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:40:25+00:00 2026-06-16T07:40:25+00:00

Here’s the script I’m trying to run: <?php $lat = $_GET[lat]; $long = $_GET[long];

  • 0

Here’s the script I’m trying to run:

    <?php
$lat = $_GET[lat];
$long = $_GET[long];
    $mysongs3 = simplexml_load_file('http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=845e721464167b9976ca031b0c3c66f3cc6563ee&query=restaurant&latitude='.$lat.'&longitude='.$long.'&results=2');
   $lat2 = $mysongs3->Result[0]->Latitude;
   $long2 = $mysongs3->Result[0]->Longitude;
   $mysongs4 = simplexml_load_file('http://www.mapquestapi.com/directions/v1/route?key=Fmjtd%7Cluuan1urn9%2Cb0%3Do5-968206&from='.$lat.', '.$long.'&to='.$lat2.', '.$long2.'&callback=renderNarrative&outFormat=xml');
echo $mysongs4->route[0]->time;
?>

It doesn’t echo anything.

It’s utilizing the MapQuest and Yahoo API (though I know that the problem is at the MapQuest API bit, because if I remove the MapQuest bit and echo it, it works). The API key is correct, btw.

$_GET[lat] is 33.8524925 and
$_GET[long] is -117.73242200000001 .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:40:26+00:00Added an answer on June 16, 2026 at 7:40 am

    The call to MapquestAPI does return the following document:

    <?xml version = "1.0" encoding = "UTF-8" ?>
    <response>
        <info>
            <statusCode>403</statusCode>
            <messages>
                <message/>
            </messages>
            <copyright>
                <imageUrl>http://api.mqcdn.com/res/mqlogo.gif</imageUrl>
                <imageAltText>© 2012 MapQuest, Inc.</imageAltText>
                <text>© 2012 MapQuest, Inc.</text>
            </copyright>
        </info>
        <route/>
    </response>
    

    As you can see at the end, the <route /> element is empty. That is why

    echo $mysongs4->route[0]->time;
    

    Is empty, too. If it would be different you would have a real problem.

    If you expect there to have something, contact the API vendor for your support options.

    Additionally I suggest you, that you create variables for the URLs so that you can debug which URLs you are actually requesting. Not that you have an error in building the URIs. Take care.


    Turns out that this is actually your issue. You need to request the API with the correct URI otherwise it does not work. Double check that you remove any spaces for the lat,long pairs, the correct URI must look like:

    http://www.mapquestapi.com/directions/v1/route?key=Fmjtd%7Cluuan1urn9%2Cb0%3Do5-968206&from=33.8524925,-117.73242200000001&to=33.863084,-117.739601&callback=renderNarrative&outFormat=xml
    

    Using that with simplexml_load_file works fine, see the example:

    $mapqueryUri = 'http://www.mapquestapi.com/directions/v1/route?key=Fmjtd%7Cluuan1urn9%2Cb0%3Do5-968206' .
                   '&from=33.8524925,-117.73242200000001&to=33.863084,-117.739601&callback=renderNarrative' .
                   '&outFormat=xml';
    $mysongs4    = simplexml_load_file($mapqueryUri);
    echo $mysongs4->asXML();
    

    Output:

    <?xml version = "1.0" encoding = "UTF-8"?>
    <response>
        <info>
            <statusCode>0</statusCode>
            <messages/>
            <copyright>
                <imageUrl>http://api.mqcdn.com/res/mqlogo.gif</imageUrl>
                <imageAltText>© 2012 MapQuest, Inc.</imageAltText>
                <text>© 2012 MapQuest, Inc.</text>
            </copyright>
        </info>
        <route>
            <sessionId>50d7729f-0223-0013-02b7-60f4-d485645ba5f2</sessionId>
            <options>
                <shapeFormat>raw</shapeFormat>
                <generalize>-1.0</generalize>
                <maxLinkId>0</maxLinkId>
                <narrativeType>text</narrativeType>
                <stateBoundaryDisplay>true</stateBoundaryDisplay>
                <countryBoundaryDisplay>true</countryBoundaryDisplay>
                <sideOfStreetDisplay>true</sideOfStreetDisplay>
                <destinationManeuverDisplay>true</destinationManeuverDisplay>
                <avoidTimedConditions>false</avoidTimedConditions>
                <enhancedNarrative>false</enhancedNarrative>
                <returnLinkDirections>false</returnLinkDirections>
                <timeType>0</timeType>
                <routeType>FASTEST</routeType>
                <locale>en_US</locale>
                <unit>M</unit>
                <tryAvoidLinkIds/>
                <mustAvoidLinkIds/>
                <manmaps>true</manmaps>
                <drivingStyle>2</drivingStyle>
                <highwayEfficiency>22.0</highwayEfficiency>
                <useTraffic>false</useTraffic>
            </options>
            <boundingBox>
                <ul>
                    <lat>33.863009999999996</lat>
                    <lng>-117.741813</lng>
                </ul>
                <lr>
                    <lat>33.852661</lat>
                    <lng>-117.732475</lng>
                </lr>
            </boundingBox>
            <distance>1.241</distance>
            <time>272</time>
            <realTime>272</realTime>
            <fuelUsed>0.089725</fuelUsed>
            <formattedTime>00:04:32</formattedTime>
            <legs>
                <leg>
                    <distance>1.241</distance>
                    <time>272</time>
                    <formattedTime>00:04:32</formattedTime>
                    <index>0</index>
                    <maneuvers>
                        <maneuver>
                            <startPoint>
                                <lat>33.8528</lat>
                                <lng>-117.7325</lng>
                            </startPoint>
                            <maneuverNotes/>
                            <distance>0.155</distance>
                            <time>34</time>
                            <formattedTime>00:00:34</formattedTime>
                            <attributes>0</attributes>
                            <turnType>6</turnType>
                            <direction>7</direction>
                            <narrative>Start out going west on E Marblehead Way toward S Hanlon Way.</narrative>
                            <directionName>West</directionName>
                            <index>0</index>
                            <streets>
                                <street>E Marblehead Way</street>
                            </streets>
                            <signs/>
                            <iconUrl><![CDATA[http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif]]></iconUrl>
                            <linkIds/>
                            <mapUrl>
                                <![CDATA[http://www.mapquestapi.com/staticmap/v4/getmap?type=map&size=225,160&pois=purple-2,33.852756,-117.732475,0,0|purple-3,33.853279,-117.73499199999999,0,0|&center=33.8530175,-117.7337335&zoom=13&key=Fmjtd|luuan1urn9,b0=o5-968206&rand=2931445&session=50d7729f-0223-0013-02b7-60f4-d485645ba5f2]]>
                            </mapUrl>
                        </maneuver>
                        <maneuver>
                            <startPoint>
                                <lat>33.8533</lat>
                                <lng>-117.735</lng>
                            </startPoint>
                            <maneuverNotes/>
                            <distance>0.521</distance>
                            <time>68</time>
                            <formattedTime>00:01:08</formattedTime>
                            <attributes>0</attributes>
                            <turnType>2</turnType>
                            <direction>2</direction>
                            <narrative>Turn right onto S Serrano Ave.</narrative>
                            <directionName>Northwest</directionName>
                            <index>1</index>
                            <streets>
                                <street>S Serrano Ave</street>
                            </streets>
                            <signs/>
                            <iconUrl><![CDATA[http://content.mapquest.com/mqsite/turnsigns/rs_right_sm.gif]]></iconUrl>
                            <linkIds/>
                            <mapUrl>
                                <![CDATA[http://www.mapquestapi.com/staticmap/v4/getmap?type=map&size=225,160&pois=purple-3,33.853279,-117.73499199999999,0,0|purple-4,33.860351,-117.737342,0,0|&center=33.856815,-117.736167&zoom=10&key=Fmjtd|luuan1urn9,b0=o5-968206&rand=2546696&session=50d7729f-0223-0013-02b7-60f4-d485645ba5f2]]>
                            </mapUrl>
                        </maneuver>
                        <maneuver>
                            <startPoint>
                                <lat>33.8604</lat>
                                <lng>-117.7373</lng>
                            </startPoint>
                            <maneuverNotes/>
                            <distance>0.199</distance>
                            <time>49</time>
                            <formattedTime>00:00:49</formattedTime>
                            <attributes>0</attributes>
                            <turnType>6</turnType>
                            <direction>7</direction>
                            <narrative>Turn left onto Canyon Creek Rd.</narrative>
                            <directionName>West</directionName>
                            <index>2</index>
                            <streets>
                                <street>Canyon Creek Rd</street>
                            </streets>
                            <signs/>
                            <iconUrl><![CDATA[http://content.mapquest.com/mqsite/turnsigns/rs_left_sm.gif]]></iconUrl>
                            <linkIds/>
                            <mapUrl>
                                <![CDATA[http://www.mapquestapi.com/staticmap/v4/getmap?type=map&size=225,160&pois=purple-4,33.860351,-117.737342,0,0|purple-5,33.860008,-117.740676,0,0|&center=33.8601795,-117.739009&zoom=13&key=Fmjtd|luuan1urn9,b0=o5-968206&rand=2546696&session=50d7729f-0223-0013-02b7-60f4-d485645ba5f2]]>
                            </mapUrl>
                        </maneuver>
                        <maneuver>
                            <startPoint>
                                <lat>33.86</lat>
                                <lng>-117.7407</lng>
                            </startPoint>
                            <maneuverNotes/>
                            <distance>0.163</distance>
                            <time>60</time>
                            <formattedTime>00:01:00</formattedTime>
                            <attributes>0</attributes>
                            <turnType>2</turnType>
                            <direction>1</direction>
                            <narrative>Turn right onto S Glenhurst Dr.</narrative>
                            <directionName>North</directionName>
                            <index>3</index>
                            <streets>
                                <street>S Glenhurst Dr</street>
                            </streets>
                            <signs/>
                            <iconUrl><![CDATA[http://content.mapquest.com/mqsite/turnsigns/rs_right_sm.gif]]></iconUrl>
                            <linkIds/>
                            <mapUrl>
                                <![CDATA[http://www.mapquestapi.com/staticmap/v4/getmap?type=map&size=225,160&pois=purple-5,33.860008,-117.740676,0,0|purple-6,33.862079,-117.741706,0,0|&center=33.8610435,-117.74119099999999&zoom=12&key=Fmjtd|luuan1urn9,b0=o5-968206&rand=2546696&session=50d7729f-0223-0013-02b7-60f4-d485645ba5f2]]>
                            </mapUrl>
                        </maneuver>
                        <maneuver>
                            <startPoint>
                                <lat>33.8621</lat>
                                <lng>-117.7417</lng>
                            </startPoint>
                            <maneuverNotes/>
                            <distance>0.044</distance>
                            <time>20</time>
                            <formattedTime>00:00:20</formattedTime>
                            <attributes>0</attributes>
                            <turnType>2</turnType>
                            <direction>3</direction>
                            <narrative>Turn right to stay on S Glenhurst Dr.</narrative>
                            <directionName>Northeast</directionName>
                            <index>4</index>
                            <streets>
                                <street>S Glenhurst Dr</street>
                            </streets>
                            <signs/>
                            <iconUrl><![CDATA[http://content.mapquest.com/mqsite/turnsigns/rs_right_sm.gif]]></iconUrl>
                            <linkIds/>
                            <mapUrl>
                                <![CDATA[http://www.mapquestapi.com/staticmap/v4/getmap?type=map&size=225,160&pois=purple-6,33.862079,-117.741706,0,0|purple-7,33.862358,-117.74101999999999,0,0|&center=33.8622185,-117.74136299999999&zoom=15&key=Fmjtd|luuan1urn9,b0=o5-968206&rand=2546696&session=50d7729f-0223-0013-02b7-60f4-d485645ba5f2]]>
                            </mapUrl>
                        </maneuver>
                        <maneuver>
                            <startPoint>
                                <lat>33.8624</lat>
                                <lng>-117.741</lng>
                            </startPoint>
                            <maneuverNotes/>
                            <distance>0.159</distance>
                            <time>41</time>
                            <formattedTime>00:00:41</formattedTime>
                            <attributes>0</attributes>
                            <turnType>2</turnType>
                            <direction>2</direction>
                            <narrative>Turn right onto E Oak Ridge Cir.</narrative>
                            <directionName>Northwest</directionName>
                            <index>5</index>
                            <streets>
                                <street>E Oak Ridge Cir</street>
                            </streets>
                            <signs/>
                            <iconUrl><![CDATA[http://content.mapquest.com/mqsite/turnsigns/rs_right_sm.gif]]></iconUrl>
                            <linkIds/>
                            <mapUrl>
                                <![CDATA[http://www.mapquestapi.com/staticmap/v4/getmap?type=map&size=225,160&pois=purple-7,33.862358,-117.74101999999999,0,0|purple-8,33.863009999999996,-117.739685,0,0|&center=33.862684,-117.7403525&zoom=14&key=Fmjtd|luuan1urn9,b0=o5-968206&rand=2546696&session=50d7729f-0223-0013-02b7-60f4-d485645ba5f2]]>
                            </mapUrl>
                        </maneuver>
                        <maneuver>
                            <startPoint/>
                            <maneuverNotes/>
                            <distance>0.0</distance>
                            <time>0</time>
                            <formattedTime>00:00:00</formattedTime>
                            <attributes>0</attributes>
                            <turnType>-1</turnType>
                            <direction>0</direction>
                            <narrative>8175 E OAK RIDGE CIR is on the right.</narrative>
                            <directionName/>
                            <index>6</index>
                            <streets/>
                            <signs/>
                            <linkIds/>
                            <mapUrl><![CDATA[]]></mapUrl>
                        </maneuver>
                    </maneuvers>
                    <hasTollRoad>false</hasTollRoad>
                    <hasFerry>false</hasFerry>
                    <hasHighway>false</hasHighway>
                    <hasSeasonalClosure>false</hasSeasonalClosure>
                    <hasUnpaved>false</hasUnpaved>
                    <hasCountryCross>false</hasCountryCross>
                </leg>
            </legs>
            <hasTollRoad>false</hasTollRoad>
            <hasFerry>false</hasFerry>
            <hasHighway>false</hasHighway>
            <hasSeasonalClosure>false</hasSeasonalClosure>
            <hasUnpaved>false</hasUnpaved>
            <hasCountryCross>false</hasCountryCross>
            <locations>
                <location>
                    <street>8250 E Marblehead Way</street>
                    <adminArea5 type="City">Anaheim</adminArea5>
                    <adminArea3 type="State">CA</adminArea3>
                    <adminArea4 type="County">Orange</adminArea4>
                    <postalCode>92808</postalCode>
                    <adminArea1 type="Country">US</adminArea1>
                    <geocodeQuality>ADDRESS</geocodeQuality>
                    <geocodeQualityCode>L1AAA</geocodeQualityCode>
                    <dragPoint>false</dragPoint>
                    <sideOfStreet>L</sideOfStreet>
                    <displayLatLng>
                        <latLng>
                            <lat>33.852492</lat>
                            <lng>-117.732422</lng>
                        </latLng>
                    </displayLatLng>
                    <linkId>24154164</linkId>
                    <type>s</type>
                    <latLng>
                        <lat>33.852492</lat>
                        <lng>-117.732422</lng>
                    </latLng>
                </location>
                <location>
                    <street>8175 E Oak Ridge Cir</street>
                    <adminArea5 type="City">Anaheim</adminArea5>
                    <adminArea3 type="State">CA</adminArea3>
                    <adminArea4 type="County">Orange</adminArea4>
                    <postalCode>92808</postalCode>
                    <adminArea1 type="Country">US</adminArea1>
                    <geocodeQuality>ADDRESS</geocodeQuality>
                    <geocodeQualityCode>L1AAA</geocodeQualityCode>
                    <dragPoint>false</dragPoint>
                    <sideOfStreet>R</sideOfStreet>
                    <displayLatLng>
                        <latLng>
                            <lat>33.863084</lat>
                            <lng>-117.739601</lng>
                        </latLng>
                    </displayLatLng>
                    <linkId>24115749</linkId>
                    <type>s</type>
                    <latLng>
                        <lat>33.863084</lat>
                        <lng>-117.739601</lng>
                    </latLng>
                </location>
            </locations>
            <locationSequence>0,1</locationSequence>
            <computedWaypoints/>
        </route>
    </response>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>
Here is the two scripts I have Script 1: <? include('config.php'); $json = $_POST['payload'];
Here is the code I'm using http://jsbin.com/evike5/edit When the jQuery UI dialog is fired
here is the site : http://www.notrepanorama.com at the bottom left, i use a jquery
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here is what I am trying to achieve in PHP: I have this string:
Here is what's going on: http://www.youtube.com/watch?v=zVEftCJ2F_U&feature=youtu.be Here is the code: extend: 'Ext.container.Viewport', alias: 'widget.viewport',
Here is a sample page having an issue: http://estorkdelivery.com/template/view/69 Our website serves up a
Here is a snippet of my code: <?php if (!defined('BASEPATH')) { exit('No direct script
Here is the code in a function I'm trying to revise. This example works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.