Page 1 of 1

Fetching data from Bus Website

Posted: Fri Mar 13, 2015 10:29 pm
by sandeep2330
Dear Co- Developers,

I am planning on making an App where i would be required to fetch data from website /server, example : Bus schedule info, any delays, Departure and Arrivals.. Is it possible to make such an App in live code, also what is required from server side so that I can fetch required data and show it in my app.. Please help..

Regards,

Re: Fetching data from Bus Website

Posted: Sat Mar 14, 2015 5:25 am
by Simon
Hi sandeep2330,
Welcome to the forums!

Does this bus site have an API for their info? That would be the "correct" way to do this.
other
It's called "page scraping" not a pro solution but a fun experiment. You'll have to figure out how to parse the pages.
Is it possible to make such an App in live code
Yes

Simon

Re: Fetching data from Bus Website

Posted: Sat Mar 14, 2015 10:56 am
by jihem
If the data are in a SQL server (MySQL, PostgreSQL, …) you need to install a web server (Apache) and add LiveCode server as CGI interpreter.
You can follow the general guideline: http://lessons.runrev.com/m/4070/l/3665 ... ith-apache .

If you want to try without having to install everything, you can download this: http://www.codyssea.com/downloads/frmCodys.zip (50Mo).
It’s a ready to use Apache-MySQL-LiveCode package (for windows).
Unzip where you want.
Launch "UniController.exe" and the call the URL http://localhost in your browser (on the same PC).

It’s based on UniserverZ. I use it to deploy my "framework” (Codys). You can have a look the folder lc.script and lc.html to understand how it works.
You will have to write a script to make the SQL queries and send the data as a JSON (you can use libJSON (http://www.codyssea.com/downloads/libJSON.zip) for this on the server.

For the client app, you will have to call the URL of your script (with parameters) and use libJSON to restore the data in a LiveCode comprehensible format.
In my apps, I store the results of each request in a local database. So when the user is offline, he can have access to the last downloaded data.

Runrev provide servers in the cloud with everything ready to use (Apache-MySQL-LiveCode).
You can contact them for a try (if the law in your country allow you to put the data in UK and/or US).

If you prefere to use NoSQL rather than SQL+JSON have a look on LiveCloud (http://livecloud.io).

Have a good day

Re: Fetching data from Bus Website

Posted: Sat Mar 14, 2015 9:00 pm
by Newbie4
The simplest and easiest way is as Simon mentioned - using an API. If the bus site has one, you can easily get the information yourself and sort, select and present it in your own way.

The following may help you get started - https://sites.google.com/a/pgcps.org/li ... me/mashups

Re: Fetching data from Bus Website

Posted: Sun Mar 15, 2015 10:27 am
by jihem
I'm agree with Newbie4 and Simon if you have only to build the client part (and you don't have access to the server scripts).
The link provided by Newbie4 describes the JSON parts as previously reported.
The best way is to manage both parts (server and client).
So you don"t have to fear about a change on the server which may break your application.

Re: Fetching data from Bus Website

Posted: Mon Mar 16, 2015 7:33 am
by sandeep2330
Thank you Simon, Newbie4 and Jihem.

I don't know whether they have API or not, is there a way to find that out ?? I am just creating this app as experiment and to learn how this thing works. I will try your suggestion and let you know how it goes.. I appreciate all your help :-)

Regards,

Re: Fetching data from Bus Website

Posted: Sat Mar 21, 2015 12:05 am
by GSPearson
If you have control over the Business website and depending on the programming language the website was written in, you can create a web service to transfer the information you needed in your app from the website. The information that is transferred back and forth is done through XML and livecode makes it easy to read in this type of data.


sandeep2330 wrote:Dear Co- Developers,

I am planning on making an App where i would be required to fetch data from website /server, example : Bus schedule info, any delays, Departure and Arrivals.. Is it possible to make such an App in live code, also what is required from server side so that I can fetch required data and show it in my app.. Please help..

Regards,