Created
March 13, 2015 17:55
-
-
Save daynebatten/22e28c734887992988fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* HTML Query String Parameters */ | |
| $options = array | |
| ( | |
| 'street' => '1600 Pennsylvania Avenue Northwest', | |
| 'city' => 'Washington', | |
| 'state' => 'DC', | |
| 'zip' => '20500', | |
| 'benchmark' => 'Public_AR_Current', | |
| 'format' => 'json' | |
| ); | |
| /* Build a URL */ | |
| $url = 'http://geocoding.geo.census.gov/geocoder/locations/address?'.http_build_query($options); | |
| /* Run query using cURL */ | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| $result = curl_exec($ch); | |
| curl_close($ch); | |
| /* Decode the JSON response, and print it out */ | |
| print_r(json_decode($result, true)); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment