Grabbing data with webserver proxy without PHP

Hello!

My city just open-source there real time bus data adhering to Google GTFS-Realtime standards. Immediately I thought this was the perfect opportunity for me to play around with Ionic for the first time.

The only way to access there data is via a CURL. They do not have access control headers set so there is a cross origin error. I have it working on my browser fine but I need a way to get this data without using PHP so I can build the app for ios.

Any suggestions on getting this data without PHP in a way that will pass the ionic build ios and launch in emulator?

Thanks!

So what I ended up doing was setting up a website with all the PHP/CURL stuff and just hitting that endpoint from the Service in my app. I’m sure there’s a better way to do it but I’m just a front-end guy trying to make it work :confused:

Yes, maybe thats the solution for access API that dont has any CORS access

If you want to build a proxy without PHP… try Node.js, Python, etc?

If you don’t want to run a server, I could think of three options:

  • neuter/bypass the cross-domain policy using a cordova plugin (you’re not targeting a regular browser, after all)

  • use somebody else’s server, e.g. json2jsonp.com (and take a risk…)

  • ask the guys maintaining the real time bus data to make the data more accessible (they probably want people to use the stuff, right?)

Awesome guys thanks for the advice! I’m going to look into some Cordova plugins and see what I can find. I have been reaching out to the city trying to get a hold of someone to talk to them about making the data more accessible. As you can imagine it’s been a nightmare.

Thanks again!