Fetching data from Bus Website

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
sandeep2330
Posts: 2
Joined: Tue Mar 10, 2015 6:46 pm

Fetching data from Bus Website

Post by sandeep2330 » Fri Mar 13, 2015 10:29 pm

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,

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Fetching data from Bus Website

Post by Simon » Sat Mar 14, 2015 5:25 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jihem
Posts: 53
Joined: Sun Jul 28, 2013 3:21 pm

Re: Fetching data from Bus Website

Post by jihem » Sat Mar 14, 2015 10:56 am

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

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 279
Joined: Sun Apr 15, 2012 1:17 am
Location: USA
Contact:

Re: Fetching data from Bus Website

Post by Newbie4 » Sat Mar 14, 2015 9:00 pm

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
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

jihem
Posts: 53
Joined: Sun Jul 28, 2013 3:21 pm

Re: Fetching data from Bus Website

Post by jihem » Sun Mar 15, 2015 10:27 am

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.

sandeep2330
Posts: 2
Joined: Tue Mar 10, 2015 6:46 pm

Re: Fetching data from Bus Website

Post by sandeep2330 » Mon Mar 16, 2015 7:33 am

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,

GSPearson
Posts: 64
Joined: Tue May 10, 2011 7:39 pm

Re: Fetching data from Bus Website

Post by GSPearson » Sat Mar 21, 2015 12:05 am

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,

Post Reply

Return to “Internet”