Skip to content

Instantly share code, notes, and snippets.

@ibuilder
Last active February 4, 2020 14:57
Show Gist options
  • Save ibuilder/bd4a010589375a6ba213144ed8e600af to your computer and use it in GitHub Desktop.
Save ibuilder/bd4a010589375a6ba213144ed8e600af to your computer and use it in GitHub Desktop.
NYC Open Data API for Deeds
<?php
$appkey = 'x3LTwBxAzd21ZTjtLeBI3C0JM';
$url='https://data.cityofnewyork.us/api/id/hzhn-3cmt.json?$limit=5000&$$app_token=$appkey';
$url = "https://data.cityofnewyork.us/api/id/hzhn-3cmt.json";
// Initialize a CURL session.
$ch = curl_init();
// Return Page contents.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//grab URL and pass it to the variable.
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
$array=json_decode($result,true);
echo '<pre>';
print_R($array);
echo '</pre>';
?>
<html>
<body>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<table class="table table-dark">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">document_id</th>
<th scope="col">record_type</th>
<th scope="col">crfn</th>
<th scope="col">recorded_borough</th>
<th scope="col">doc_type</th>
<th scope="col">document_date</th>
<th scope="col">document_amt</th>
<th scope="col">recorded_datetime</th>
<th scope="col">percent_trans</th>
</tr>
</thead>
<tbody>
<?php
for($i = 0 ;$i <count($array);$i++){
?>
<tr>
<th scope="row"><?php echo $i+1;?></th>
<td><?php echo $array[$i]['document_id']?></td>
<td><?php echo $array[$i]['record_type']?></td>
<td><?php echo $array[$i]['crfn']?></td>
<td><?php echo $array[$i]['recorded_borough']?></td>
<td><?php echo $array[$i]['doc_type']?></td>
<td><?php echo $array[$i]['document_date']?></td>
<td><?php echo $array[$i]['document_amt']?></td>
<td><?php echo $array[$i]['recorded_datetime']?></td>
<td><?php echo $array[$i]['percent_trans']?></td>
</tr>
<?php } ?>
</tbody>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment