title: Flight distance using Google API
body: <p>I have been desperately trying to make a flight distance calculator using Google API.</p>
  
  <p>The closest I have come is getting road distance, using an answer posted on another SO question (<a href="https://stackoverflow.com/questions/14041227/distance-from-point-a-to-b-using-google-maps-php-and-mysql">Distance from point A to B using Google Maps, PHP and MySQL</a>), which was as follows:</p>
  
  <pre><code>$from = "Więckowskiego 72, Łódź";
  $to = "Gazowa 1, Łódź";
  
  $from = urlencode($from);
  $to = urlencode($to);
  
  $data = file_get_contents("http://maps.googleapis.com/maps/api/distancematrix/json?origins=$from&amp;destinations=$to&amp;language=en-EN&amp;sensor=false");
  $data = json_decode($data);
  
  $time = 0;
  $distance = 0;
  
  foreach($data-&gt;rows[0]-&gt;elements as $road) {
      $time += $road-&gt;duration-&gt;value;
      $distance += $road-&gt;distance-&gt;value;
  }
  
  echo "To: ".$data-&gt;destination_addresses[0];
  echo "&lt;br/&gt;";
  echo "From: ".$data-&gt;origin_addresses[0];
  echo "&lt;br/&gt;";
  echo "Time: ".$time." seconds";
  echo "&lt;br/&gt;";
  echo "Distance: ".$distance." meters";
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>To: Gazowa 1, 91-076 Łódź, Poland
  From: Więckowskiego 72, Łódź, Poland
  Time: 206 seconds
  Distance: 1488 meters
  </code></pre>
  
  <p>Is there any simple way of getting the above to provide the distance as the crow flies?</p>