simplexml


Pick shortest route with simpleXML


First post so bear with me.
I have hacked together an module for Oscommerce that figures the delivery cost for a pizza delivery.
I used the google distance matrix and got it working only to discover that it picks the fastest route and not the shortest. and there was no option to tell it to pick the shortest.
Oh well.. I poked arround and found that i could use the direction api instead
http://maps.googleapis.com/maps/api/directions/xml?origin=Svendborgvej%20323,%205260%20Odense%20S,%20Denmark&destination=Albanivej%2027,%205792%20%C3%85rslev&alternatives=true
now i have 2 routes in that XML and i need
pick the shortest one
extract the distance from it
my code so far: http://pastebin.com/t3KY5Qzn
i'm not a very good programmer and a bit stuck here... anyone that could help me out?
i used an online xml viewer to get a more human readable format and i can see the 2 blocks with 1 route in it and also the total distance in each..
its a simple as: echo min($result)
from there its simple to mod my module so it picks the shortest route of those google might give

Related Links

Iterating through and editing a SimpleXML object by reference in PHP
Simplexml Insert into sub element
warning: simplexml_load_file(): I/O warning : failed to load external entity drupal [closed]
What's wrong with this code? SimpleXMLElement [closed]
Get children attributes using simplexml
Select attribute in simplexml
Save formatted xml
SimpleXML (Zend_Config_Xml actually) and foreach : which tag am I iterating?
simplexml_load_file() error happening in only localhost/xampp
SimpleXml tar.gz
simplexml_load_file error in PHP 5.3
simplexml_load_file not a valid URI issue
Can't turn XML response into an simplexml object
Having trouble getting Fogbugz API response into a SimpleXML object
Upgraded to php 5.3.10 and simpleXMLelement is broken
Parsing RSS Feed with SimpleXML

Categories

HOME
compiler-construction
arduino-uno
deployment
gremlin
deezer
google-play
razor
sqlite3
jpeg
ckeditor
onelogin
reveal.js
zend-framework3
windows-azure-storage
remote-access
iolanguage
worldwind
google-static-maps
invantive-sql
solaris-10
clickonce
tokenize
language-agnostic
tibco-mdm
sparse-matrix
fish
poltergeist
kannel
linkerd
windows-error-reporting
fluentvalidation
gsmcomm
delicious-api
media-queries
.net-4.0
semantic-versioning
oracle-fusion-middleware
jspresso
noraui
catch-all
multilingual
gesture
vapor
jna
estimote
flashair
acoustics
.net-4.6.2
skeleton-css-boilerplate
qwt
youcompleteme
upstart
datastax-startup
domain-model
mu
jxcore
cudafy.net
google-cdn
vmware-tools
phishing
mikroc
storekit
packagist
bluemix-app-scan
bluegiga
design-by-contract
revolution-r
ios8-today-widget
t4mvc
intellij-14
fouc
libressl
wyam
tableau-online
responsive-images
unity3d-gui
iiviewdeckcontroller
e10s
truevault
python-green
ceil
phpthumb
jboss-weld
android-2.2-froyo
transcoding
jmapviewer
web2py-modules
batterylevel
angularjs-controller
coderush
postgresql-performance
custom-backend
netdna-api
nsobject
pydot
xmlspy
invite
ecl
calling-convention
floating
ctp4
sustainable-pace
nerddinner
spec#
django-notification

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App