Hightower Posted June 9, 2010 Posted June 9, 2010 I am starting a new project which is going to be a website based on PHP. I'm quite handy with PHP/MySQL/HTML etc, but need some advice on something completely new to me. The website will grab information from the database and display it in a browser - simples. But once the website is completed I will continue the project by developing an Android app. What is the best way to produce this website so that the same queries etc can easily be ported to Android? I've heard that XML is the way to do this, but I really don't know how/where to start. Can anybody point me in the direction of creating a website that can be easily ported to Android afterwards?
ZeroHour Posted June 9, 2010 Posted June 9, 2010 Erm are you talking about making a mobile friendly web page or an actual app? Android uses java as its base language which means you have to learn that first (which is not too bad tbh)
webman Posted June 9, 2010 Posted June 9, 2010 I would probably look at implementing a REST-based service for the Android/remote part. Code your internal/database interaction as classes and functions, and then have the website and the REST interface use these as needed. Use something like Flourish or CodeIgniter to help you; why re-invent the wheel? I saw a great presentation by PHP guru Loran Jane Mitchell a few months ago - PHP And Web Services: Perfect Partners
Hightower Posted June 9, 2010 Author Posted June 9, 2010 It's a case of making an actual app, rather than a web page designed for mobile devices. I've looked at SOAP and REST and it looks like I'm to do some extra reading to understand fully....
SimpleSi Posted June 9, 2010 Posted June 9, 2010 I've seen other suggestions that for small number of queries is to just to http get/post calls to "dark" php pages on your server and then scrape the resulting output. But not tried it yet regards Simon
dhicks Posted June 9, 2010 Posted June 9, 2010 What is the best way to produce this website so that the same queries etc can easily be ported to Android? Is the problem that you don't know how to produce a "web service", or that you don't know how to go about writing an Android app, or a mixture of the two? Do the queries to the database need to be secure? If not , the simplest thing possible is to simply write a PHP page that outputs the result of a query as XML instead of HTML. It can still take parameters like a normal PHP page, so all you have to do is visit a URL such as "http://app.com/doQuery?name=fred&colour=blue" and get a bunch of XML in return. According to this post: How to call web service with Android - Stack Overflow JSON might be a more suitible format to return your results in, though. -- David Hicks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now