Re: Calculating driving distance between UK postcodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday, May 4, 2012 at 10:18, Terry Ally (Gmail) wrote:
> Google works in Javascript extensively - not a language with which I
> have in-depth experience hence my reason for asking for PHP solution.
> 
> For example the following will get me a JSON output with the distance in
> Kms and time. I don't know how to get PHP to read this information and
> extract just the distance. I need the distance so that I can calculate cost
> of a trip.
> 
> <form id="google" action="
> http://maps.googleapis.com/maps/api/distancematrix/json"; method="get">
> <input type="text" name="origins" value="" />
> <input type="text" name="destinations" value="" />
> <input type="hidden" name="sensor" value="false">
> <input type="hidden" name="submitted" value="1">
> <br><a type="submit"
> onClick="document.getElementById('google').submit()"><strong><strong>Get
> Distance</strong></strong></a>
> </form>
> 
> 
> 
> 
> 
> On 4 May 2012 15:08, David OBrien <dgobrien@xxxxxxxxx> wrote:
> 
> > Google is still your friend
> > 
> > On Fri, May 4, 2012 at 9:36 AM, Terry Ally (Gmail) <terryally@xxxxxxxxx>wrote:
> > 
> > > Does anyone have a working/example PHP script that calculates driving
> > > distances between UK postcodes that they can share?
> > > 
> > > Thanks
> > > 
> > > --
> > > *Terry Ally*
> > > 
> > > Twitter.com/terryally
> > > Facebook.com/terryally
> > > ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
> > > To print or not to print this email is the environmentally-searching
> > > question!
> > > Which has the highest ecological cost? A sheet of paper or constantly
> > > switching on your computer and connecting to the Internet to read your
> > > email?
> > > 
> > 
> > 
> > 
> > http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk
> 
> 
> 
> 
> -- 
> *Terry Ally*
> Twitter.com/terryally
> Facebook.com/terryally
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
> To print or not to print this email is the environmentally-searching
> question!
> Which has the highest ecological cost? A sheet of paper or constantly
> switching on your computer and connecting to the Internet to read your
> email?
> 
> 

You should look into curl. Make a post request with the form data as post payload. 


-- 
Mike Mackintosh
www.HighOnPHP.com

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux