# Relatime train data to a Text file

**URL:** <https://opendataforum.transport.nsw.gov.au/t/relatime-train-data-to-a-text-file/598>\
**Category:** Real-time Public Transport\
**Created:** [February 9, 2017, 11:19pm UTC](https://opendataforum.transport.nsw.gov.au/t/relatime-train-data-to-a-text-file/598 "2017-02-09T23:19:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![200george](https://avatars.discourse-cdn.com/v4/letter/2/b77776/32.png) [@200george](https://opendataforum.transport.nsw.gov.au/u/200george)\
**Post date:** [February 9, 2017, 11:19pm UTC](https://opendataforum.transport.nsw.gov.au/t/relatime-train-data-to-a-text-file/598/1 "2017-02-09T23:19:07Z")

</div>

Hello People,  
I am new to API, PHP and any type of coding. Please forgive me if I sound dumb or unclear.

We wanted to generate a text file using a script/Code (php ) to fetch real-time train data from a specific station (Circular quay or Wynyard) for next 5-10 trains using API key. can anyone please help or guide on how to create the script with stop ID to generate a text file output.  
I have tried to follow the instruction provided on the NSW portal but unable to code with stop ID or generate a text file output. we do have NEC live Parser which will Parse the PHP and will keep refreshing the text file each 600 Mili second.

Thanks  
Anir

---

<div class="post-metadata">

**Author:** ![jason120au](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@jason120au](https://opendataforum.transport.nsw.gov.au/u/jason120au)\
**Post date:** [February 9, 2017, 11:50pm UTC](https://opendataforum.transport.nsw.gov.au/t/relatime-train-data-to-a-text-file/598/2 "2017-02-09T23:50:58Z")

</div>

If you follow the instructions using the API Explorer to download the realtime file in Protocol Buffer format. THe easist way to convert the file to json format is to download a Python script to convert it. All of which are available with examples on the Google GTFS Realtime page at [Feed examples &nbsp;|&nbsp; Realtime Transit &nbsp;|&nbsp; Google Developers](https://developers.google.com/transit/gtfs-realtime/examples)

---

<div class="post-metadata">

**Author:** ![yvonne.lee](https://avatars.discourse-cdn.com/v4/letter/y/c37758/32.png) [@yvonne.lee](https://opendataforum.transport.nsw.gov.au/u/yvonne.lee)\
**Post date:** [February 12, 2017, 9:45pm UTC](https://opendataforum.transport.nsw.gov.au/t/relatime-train-data-to-a-text-file/598/3 "2017-02-12T21:45:56Z")

</div>

Hi Anir –

We also have some APIs which we’ll be releasing publicly in a few week’s time. They are currently going through testing and verification. These may be more suitable to your needs.
