Fetching data from Bus Website
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 2
- Joined: Tue Mar 10, 2015 6:46 pm
Fetching data from Bus Website
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,
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,
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Fetching data from Bus Website
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.
Simon
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.
YesIs it possible to make such an App in live code
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Fetching data from Bus Website
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
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
-
- VIP Livecode Opensource Backer
- Posts: 327
- Joined: Sun Apr 15, 2012 1:17 am
- Location: USA
- Contact:
Re: Fetching data from Bus Website
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
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/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
Re: Fetching data from Bus Website
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.
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.
-
- Posts: 2
- Joined: Tue Mar 10, 2015 6:46 pm
Re: Fetching data from Bus Website
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,
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
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,