Walk Score Professional

This is a live example of the Walk Score API:

AJAX API Overview

Using the Walk Score API requires knowledge of AJAX and server-side scripting. Specifically:

  • Making an AJAX call to a script on your server. The example on this page uses the the JQuery JavaScript library to handle the AJAX request.
    (Use your browser's view source command to see the code.)
  • Calling the Walk Score API from your server-side script and returning the response to the JavaScript client (see PHP example below).
  • The Walk Score is dynamically written into the HTML page using JavaScript.

Making a Server-Side API Request

This is a PHP example for a server-side script that calls the Walk Score API from your server.

<?
 function getWalkScore($lat, $lon, $address) {
  $address=urlencode($address);
  $url = "http://api.walkscore.com/score?format=json&address=$address";
  $url .= "&lat=$lat&lon=$lon&wsapikey=YOUR-API-KEY";
  $str = @file_get_contents($url);
  return $str;
 }

 $lat = $_GET['lat'];
 $lon = $_GET['lon'];
 $address = stripslashes($_GET['address']);
 $json = getWalkScore($lat,$lon,$address);
 echo $json;
?>


Back to the Walk Score API documentation.

Contact us for tech support.