How load PHP website on the iPad simulator or device? - php

I have one .php web site and I want to put it in iPad application "web application".
I mean create UIWebView and load files in WebView, so my First question is, is it possible to create this webApp and can I run it on Xcode simulator?
What do I need for implementing this application (Apache, MySQL) inside ipad outside?
Basically I want to have all my .php class inside of app and run it via iPad app, it means that if I hadn't any internet I can run the application.
Since I want to run it in both iPad and XCode simulator.
Would you please give me some hints for implement this application?

A few points you need to think about:
App Store Approval - if you intend to market this app (i.e it's not for jailbroken devices via Cydia, or an in-house corporate app) then you will most likely run in to issues with the approval process.*
You're intending to bundle in a scripting language with your application. Now this may not be an issue depending on whether or not this is exposed to the end-user; but you do run the risk of Apple finding out and pulling the plug.
The alternative to bundling in a scripting language (PHP in your case) is going to be loading the code off of an external server. This is a no-no straight away, as Apple requires your application to have functionality offline - or atleast they did. Where this leaves all the Social Networking and other network-dependant apps... Well, I guess there are exceptions!
Device Performance - you're essentially intending to run a small web server on a mobile device; a tablet in this case. This could be very resource intensive, so is probably not wise. I personally wouldn't want my battery being drained because someone has decided that they want to bundle in a web server with their application.
Your implementation idea itself is sound, in the respect of using a UIWebView. You should probably check out the Apache Cordova/PhoneGap framework, and that should satisfy your needs and provide an off-the-shelf way of packaging up your web app. If you do need custom functionality then it's worth looking at anyway; plugins are relatively easy to develop, there's a wide range available already and the plans for cordova now are to allow developers to implement it into native applications. (Say, if only one view requires PhoneGap functionality etc)
Personally, I fail to see what requires PHP that can not be done via HTML5 and PhoneGap. There are storage options available, SQL options, you're using web technologies so can easily query external web services. It's also a lot safer with regards to app approval - as it's tried and tested; there are many applications build using such solutions already in the store.
I think you need a serious re-think. Otherwise, perhaps you could post some more details?

Please note that PHP is a server-side language. So do you want to run a server on your iPad? If so, you can develop PHP applications on a proper desktop/laptop and then view them on iPad Safari browser over Wifi.
Otherwise you can install LightHTTPd server with PHP libraries, MySQL, CURL and all from Cydia app store on a jailbroken iOS device to get a full environment. For Android there is this app PAW server available which can run an Apache server in such devices.

If you just want to check your website is working fine on small devices, or you want to check responsiveness of your website. Go to:Ipad Peek and run your website on given devices/simulators using url.

A simple google search pulled up this free framework: http://www.ipfaces.org/
I've never used to before, but it might do what you need.

Related

Mobile application sharing the same data with the website

I'm totally new about mobile application development and i'm getting really confused about few things.
I'm actually developing web application under zend framework 2 (php framework) and Zend studio (IDE).
So to not starting all over again i want to make a mobile app (for learning purpose) with ZF2 and Zend studio.
I've been following that tutorial.
So i'm not sure to understand how the data are stored. Until now i have used MySQL with phpmyadmin for my web applications.
From what i understand, i need to use a cloud server such as Parse, phpcloud or else, am i right?
My question is, how the website and the mobile app will share the same data?
typically you will have to write web services that will expose a few methods which in turn will get the required data you want to share.
So your connectivity should look like Mobile APP --> Web Service --> DB
Make sure to thrown in some kind of authentication to avoid abuse of your web services. The webservice can be deployed on the same server that is hosting the website
One more way is to access the mysql database directly from your mobile application . This is NOT recommended because essentially you are exposing your DB to the world. This is OK in case of a corporate application which will only work within your company network or with a controlled environment.
You can use a PaaS like Heroku or Openshift to host your web application. But The web application must also expose a set of web services, which can be used to send and receive information to and from the mobile app.
I think the tutorial you mentioned explaining about building a mobile web site. That is you need to support your web site for small screens like mobile phones or tablets.
If you are planing to build a native mobile application, best approach would be to expose core services using RESTful web services.
using the same database... you have 2 options.... either make a php script to attend the mobile request, or creating a special mysql user that has access to the same database your website uses...

Chrome web apps - server side support

Does Google Chrome web store support server sided technologies such as PHP or Python?
I am currently making a productive web application which i have already implemented in python but i wish to give it a nice little web application interface and also harness the power of PHP...
Does Chrome support Python or PHP; or does Chrome even support Server sided scripting?
I am learning how to develop chrome apps from here...
If a member is aware of any better tutorials please inform me...
Or is it that i just have to build a normal web applications and add a logo and manifest and zip it and publish it?
Thankyou...
The platform supports server-side technologies the same way a C++ or Java application would support them: through HTTP (probably RESTful) interfaces that the server side of your app (if any) exposes. For example, your app might make a request to http://example.com/api/foo/bar/baz?param1=123&param2=456, and might get back a JSON response that your app would then parse. It doesn't really matter which server-side technology you're using, because the API looks the same from the app's perspective.
If you're asking about PHP, Ruby, Python, Go, node.js, etc., running on the user's machine as a client-side app, no, that's not how Chrome packaged apps work (though in theory one could get one of those environments running as a NaCl module that then generates client-side code). Instead, you write code in a very similar way to how you'd write a pure AJAX app: in JavaScript, without navigation, with the content/data being fetched in a RESTful fashion from whatever server/service you use (or none in the case of something like a calculator or simple game that doesn't talk to the network at all). Incidentally, we're finding that very AJAXy apps are relatively simple to convert to packaged apps.
Check out all the samples at https://github.com/GoogleChrome/chrome-app-samples to get more an idea of the shape of the platform.

package php as an android application?

I'm developing an Android app, and due to time circumstances, I started developing the project in PHP, together with a MySQL backend. is it possible to package the project folder as a APK where it could be opened within the tablet?
I understand Android applications are meant to be written in Java, and I have checked out:
http://phpforandroid.net/
But it doesn't answer if it was possible to package a complete PHP project as an APK.
No. Since PHP is a server side language you would have to run a webserver and a MySQL server on the device (like #deceze said).
Since you have already started development in PHP my recommendation would be to develop a web based application and have your users access it from a very lightweight client on the Android device. You could use something like PhoneGap or AppCelerator to develop a front end client app since I'm guessing your talents lie in web development :)
"When all you have is a hammer, you start to approach every problem as if it was a nail"
You're using the wrong tool for the job. PHP is not meant for writing interactive GUI applications, it's meant for running server side scripts or commandline scripts. Even if you could easily run PHP on an android phone (which you cant), it would be the wrong choice of language for a phone app.
You have two options
1) throw away the work you've done so far and redo it in a language more appropriate to the task at hand
2) deploy your application to a publicly accessible web server and run it via the handset's web browser.
If you think about it, you'd need to squeeze a web server, the PHP core, whatever extensions your application uses and a MySQL server onto a handheld device. This is seriously overkill.
And why MySQL? Android provides SQLite database support.

Moving php apps to Android and iPhone

I am a php developer with a few web apps like a project management app and a forum i'd like to move to Android and iPhone.
I've heard of developers using Sencha Touch and PhoneGap to develop native apps and I know they support HTML5, CSS and Javascript, but how abot PHP? And is are there any other APIs/frameworks I should consider that better support local server scripting?
Speaking about webapp, maybe you can avoid building an app by having a mobile enabled version of your website compliant with all the client browsers.
Have a look at jquerymobile, it is compliant with mostly all the mobile browsers and you will be able to reuse your code.
To answer correctly, you can call your webservices using ajax to fetch json/xml/etc data from Phonegap because it is using jQuerymobile ;-)
Have a look at this discussion here on Stackoverflow :
Passing formdata from Phonegap to PHP with JSON
Hope this helps
PHP is a server-side scripting language and your .php files have to be stored on the server side. You can access them asynchronously with Ajax, so no, you can not include php files (with reasonable time and effort) in your app.
The only smart way to go here is native iOS apps, forget PHP, Android and the rest of that crap. By the way I'm not trying to be an iOS snob here but am just reflecting on a few realities. One is that iOS apps can actually make money though a web replacement app might not. The second issue is that going native demands a reboot on your part, that is best done on one platform until you get up to speed. The third issue is that users now a days expect well performing apps that don't have a lot of web cruft in them. Fourth the Android marketplace is screwed, you are far more likely to establish that critical user base on iOS as you can target a handful of platforms running the latest generation of iOS, android is by comparison a pathetic mess of old versions of android running on all sorts of hardware.
On iOS look a BlueAlien as an example of a better than web method of accessing Reddit.

Developing Mobile App (Iphone,Blackberry,Android) for an existing website

I have a website and am planning to develop a mobile version of it for the iphone, blackberry and android.
My website is a social network built on PHP Zend framework. Now all these mobile apps are going to be having the same functionality like the website.
I am little ignorant about this - but from a high level I understand that all these mobile apps should not have to write any backend logic. For every functionality - they will simply make a web service API call to interact with the backend.
So does that mean, for every functionality I need to create a web service method. Can the existing code be re used - I'm a little lost -
Can someone shed some light on this matter or point me in the right direction (like some articles)
Thanks
I think the best thing for this kind of application would be write a mobile website. This should not include more than some new views in your Zend framework application.
There are some tutorials out there how to start. Just use your favorite search engine.
Apple and Android have browsers which are very advanced. They actually show the site in total. The point is would your website look better in that interface? ( I bet it would be cumbersome). You would have to make a mobile site (as suggested by #Felix) and implement the required features in a simple interface.
If you want an installable application then you are looking at three applications(one for each platform). My suggestion would be to make the mobile site and look for an app maker kind of product which would install your regular mobile site as an application on these platforms.
HTH
This is a very open subject that's obviously going to divide opinion (as already demonstrated it seems! :))
My personal view on it it this, using Safari on my iPhone is a terrible clunky cumbersome experience and "mobile optimised" websites are not ideal and don't really take advantage of the features of the device you are developing for (i.e. multi-touch etc)
This is why I think mobile applications are more appropriate ways of encapsulating the content of the web and delivering in a format suitable for its platform. Take for example, the Facebook application for iPhone and Android. That's a perfect example of taking the core features of the website and contextualising it in a manner that's easy to use and designed from the ground up for the device it's made for.
In answer to your question then yes, I would approach the development with web services in mind and use these to feedback the relevant data you need to interface with your site
While I agree with djhworld that the native mobile applications are sometimes easier to use than mobile-optimized web apps, there is a pretty big gulf in implementation time and user base fragmentation. I think the best first step is to develop a mobile web application, and if you are getting use there, consider developing native apps using web services. You may also want to look at PhoneGap as a way to cross-compile a single mobile app:
http://phonegap.com/
Also, see my other post about mobile web application development.
If you want to maximize your investment in your mobile site, I would develop it in HTML5. Currently, only WebKit browsers support it (iPhone/iPod/iPad/Android/Blackberry[soon]), but within a year most devices in developed countries will support it.
If you need to detect mobile devices on the server side, I would recommend Tera-WURFL. It is a high-speed PHP & MySQL mobile device detection software package that is free and open source.

Categories