I had to make a simple proxy because the MTA server doesn't accept
javascript cross domain scripting. It could be solved by adding a
Access-control-allow header at the top of a php script on the MTA's
side,until then you will need a proxy.
The reason why I used file get contents instead of curl or a wget is
because most of the time File get contents work by default on most PHP
installations.
<?php
// your mta bustime key
$mtakey=' YOUR - BUSTIME - KEY ';
// GET bus ID from url
$busid=$_GET['busid'];
// grab the json data from mta
$json = file_get_contents("
http://bustime.mta.info/api/siri/vehicle-
monitoring.json?key=$mtakey&OperatorRef=MTA%20NYCT&LineRef=
$busid&VehicleMonitoringDetailLevel=calls");
// echo the data
echo $json;
?>