edmonscommerce and Julian are on the right track.
However, I went the same way, and I found that implementing the PHP protocol protocols is cumbersome (especially when submitting the NYTT MTA).
Alternative method (Command line + JSON):
If you are comfortable with command line and JSON tools, I wrote a standalone tool that converts GTFS-realtime to plain JSON: https://github.com/harrytruong/gtfs_realtime_json
Just download (without installation) and run: gtfs_realtime_json <feed_url>
Here is sample JSON output .
To use this in PHP , just put gtfs_realtime_json in the same directory as your scripts and run the following:
<?php $json = exec('./gtfs_realtime_json "http://developer.mbta.com/lib/GTRTFS/Alerts/VehiclePositions.pb"'); $feed = json_decode($json, TRUE); var_dump($feed);
source share