PHP for iPad, or other solutions - php

Here's a tricky one.
I'm developing a web app for iPads that will be installed as kiosks. The app is essentially a quiz. Wont need to store data in a database, but will need to process data from 1 page to another page (from questions page to results page).
Original solution was simple PHP. I have now been informed that wi-fi/3g will be unavailable to the kiosks, so they wont have access to the webserver w/ php that has been working like a charm. App needs to be browser-based.
Looked around for solutions for installing PHP on iPad, like PHPPOD from Cydia, but unsure if that is even an option for iPad...and we wont be jailbreaking them. Can this even be done w/o php?

If you won't be jailbreaking them, trying to get a working PHP interpreter on them might not be impossible, but it'll probably be at the very least annoyingly difficult (and it's unlikely Apple would approve random PHP interpreters in their app store).
I'd suggest trying to port the app to Javascript instead. If it's just a simple questions -> results flow, writing a basic Javascript web app with jQuery to help out if need be shouldn't be too painful.

If you're not jailbreaking them, then you will NOT be able to get any un-approved apps onto them. Apple does NOT want you to bypass the app store, because they want their 30% cut. Installing a PHP interpreter on an iphone/ipad would allow you to build apps outside of Apple's control - this is THE main reason why Flash will never been on an iphone - it's not just for playing movies, it's actually a pretty full runtime environment.
You could try using HTML5 local storage, or use the native SQLlite database in iOS.

Without wifi/3G you would need local storage won't you? For this you need not jailbreak your iPad & force it to work through PHP. You could do that following -
Jailbreak the app & maybe try to get your PHP solution working on iPad.
Build a native app with local storage (using sqlite or core data) & handle the display through UIWebView.
Build a HTML5 app with local storage is easy to do nowadays, again UIWebView would be used.
As Amber suggests, you could build all your quizzing logic in javascript, but I am concerned here as to where you'll store data. You need to refer to point 3.
Hope this helps...

Related

Can PHP be accessible offline?

My Employer would like me to take a web application written entirely in PHP to be accessible while offline. (it has to be accessible by an ipad without internet connection.)
I have tried the following things:
http://solesignal.com/draftcode/
http://blog.smartbear.com/codereviewer/15-code-editors-for-the-ipad-for-free-or-very-cheap/
https://itunes.apple.com/us/app/offline-pages-save-complete/id364859644?mt=8
Before I'm going to spend any money i have to be 100% positive it works.
Does anyone know how i can achieve this?
What do you mean by offline?
If you're looking to embed the server within your app, you're out of luck, it's not possible nor allowed. However if you want to run a local environment in your computer, take a look at MAMP
Knowing more about Mike's question, He's trying to run a website/webapp made in PHP offline/stand-alone on iOS devices.
As PHP is a pre-processor, this is not possible without a seperate server doing the magic. Depending on what this application has to do, I suggest you try to re-make the webapp so it does not use PHP. A lot of the things done with PHP can also be done client-side with JavaScript.
If you require more sophisticated things, try looking into the Meteor Framework. It supports PhoneGap exportation natively so the applications can run stand-alone on mobile devices as apps.
EDIT: If you can use an android device, you CAN run a PHP server on the same device as the pages are displayed because android is simply more open then iOS. If you're not willing to re-write the PHP code to JS, grab an android tab and use a PHP server package for android like this or another one that does include a MySQL server like this one

Database record wont show on my mobile application

I use html5 + css3 + jquery mobile to built my mobile application. Actually I've already desktop version, and i want to make mobile application.
Is that true php wont work on html5 for mobile application?
If that true, i use ajax for call my JSON (that place create on jsontext.php).
I tried HTML5 on desktop browser and it worked.
I built it to apk using build.phonegap.com and install the apk to my device.
After that, my database record not showing. Maybe it didn't execute.
Other user in stackoverflow said we can use backbone.js. how-to-access-a-remote-database-from-jquery-mobile-application
are my steps right? or I have to use backbone.js. THX.
Here's some answers:
Yes, php won't work in a mobile native/hibrid mobile application,
because php needs to be interpreted by a php server before
generating output.
Its easy and simple to both generate and parse JSON, it's widely
used in apps.
That is good. If you want an 'online-only' kind of app, you can use
a webview and point it the url of your app - its basically a browser
without navigation buttons and user interface - but something's
don't work that well, you should test before. It may also display
your app as sluggish and unpolished.
No problem with that, Cordova/Phonegap is actually becoming a very
good mobile framework. You should also install ADB
(http://developer.android.com/tools/help/adb.html), ADT
(http://developer.android.com/tools/help/adt.html) and the Android
device emulator
(http://developer.android.com/tools/help/emulator.html).
You must be sure on how to insert and retrieve dabatase records.
This depends on how you programmed it. Be sure to have the database
available publicly (accessible only from the apps, though).
Hope I've answered your questions, and that it helped.

Web application to sync data with Android phone application

I already know quite a few tricks with Android java and I have an application that I need to sync with a web application. What it needs to be doing is connect to a server and sync database and download jpg picture uploaded by user. The web application should also be for more users each with his own phone and Android application in it, so it should probably be accesable via login and password.
My problem is that I have zero experience with web applications. All I know is a little HTML. So my question is, how should I start? What language do I use? And what basic structure or principle should my web application have?
Thank you!
I would recommend a PHP - MySQL solution. PHP and MySQL are open source and I know Java can interface with that kind of database. Both languages are well documented and PHP is similar to Java in that it is C-based, so if you know Java fairly well, PHP should be relatively straightforward for you. I would recommend heading over to Lynda.com and searching for PHP Essential Training with Kevin Skoglund. Lynda is a great online video tutorial site and you can access a good amount of the content for free. But if you're serious about developing this web application, I would make the investment (I was, and I did, and I am glad). That's how I learned PHP / MySQL for the most part.
First off, to do any PHP / MySQL development, you'll need to install a server onto your computer, such as WAMP (Windows Apache MySQL PHP - for windows), MAMP (Mac " " - for mac), or LAMP (Linux " " - for Linux), where you will be able to begin developing your application. This is your "test" server, or "development" server. For instance, I use MAMP since I am on a Mac. MAMP is free, as are the other versions, but you can pay for an upgrade. For your purposes, start with the free version. Essentially, *AMP comes with the Apache Server software, MySQL database installation, and PHP installation pre-packaged and ready to go with minimal configuration. From there, you can start writing PHP and MySQL and get your project rolling.
As a matter of fact, that title at Lynda.com, PHP Essential Training, will walk you through ALL of the steps I just stated, AND, uses an exercise project of setting up a basic Content Management System to include password protection, user login and authentication, as well as all of the essential PHP and MySQL that you'll need to go along with it. Seriously, check out Lynda.com.
Good Luck!
This is a very open question and you might get a huge range of different answers, neither of them perfect. However, I will try to put a simple response.
Have a single server and expose from it web services. This web services will handle the CRUD of the data (I will assume you will use a database and that you have experience with databases).
Web services is a big topic. If you want the simplest web services, and you're planning to use PHP, I will suggest using RESTful with JSON, since it will be very simple.
The web application should be within the same domain/server of the web services, at least for the beginning (if it grows, you can change this architecture), since that way you won't require using JSONP and just stick to standard AJAX (I will now assume you don't know what JSONP is, I will suggest reading: http://remysharp.com/2007/10/08/what-is-jsonp/ which is just the first result I got on Google just now ;)) and it will be easier.
You say you have experience with Android. I will assume you know how to consume web services using Java/Android. In case you don't, here's a sample of how to do it: http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
Please note the PHP code there is pretty dirty, but as a "how to", I think it looks great. Only thing to note is: the sample uses HttpClient, while the preferred method is to use HttpURLConnection ( http://android-developers.blogspot.mx/2011/09/androids-http-clients.html)
Having said this, PHP + MySQL is standard. In the web app, you SHOULD USE HTML. Please, don't use Flash or Java Applets (I smiled a bit by even mentioning Java Applets in here). For all the communication purposes between the web service and the HTML client, I recommend using jQuery ( http://jquery.com/ ) with AJAX.
Don't go with a JSONP API unless you want other websites to be able to use your API.
This is only a quick approach created with the little information you have given. The more (and clearer) information you give, a better solution is likely to appear.

Dreamweaver's build app function in cs 5.5 breaks if there is php code?

For javascript and html files only, Dreamweaver's build app for android function seems to work great in cs 5.5. But when any php code is put in (for authentication, or for ajaxing in web service returns ) it seems that the android app just displays broken php code instead of executing it. When building the app, Dreamweaver won't even let you use a root php file in the project; it only seems to only accept html files.
Am I doing something wrong? Building apps out of web language-based files seems a lot less useful if server-side code isn't allowed.
Are there any other alternatives? Titanium studio looks really complicated, but I'm willing to read the docs if it's worth the time.
http://help.adobe.com/en_US/dreamweaver/cs/using/WSeffff8bffc80208478c8d43312e240fe0ad-8000.html
Indeed it only packages HTML, CSS and Javascript into an Android or iOS package.
I'm afraid you'll have to learn real Android development if you want something more complex.
Dreamweaver will package the files up just like you asked, however, the destination system is what runs the code. Android doesn't execute the PHP within the app. Your app has to connect with a remote server that is to handle the log in. Thinks of two separate apps, one on the phone and one on your server.
Android doesn't execute the PHP within the app. This is because PHP is a server side client and Not client side. Unless they create some inbuit servers within phones from which native apps can tap into. One option you can use is to use html files and within them, create links to php files which are in online servers so as to have your scripts executed.

Live Video Streaming with PHP

I have a PHP/AJAX/MYSQL chat application. I want to add video chatting to my application. How can I create live video streaming to be used for live video conferences/chatting in a PHP application. What are the key-terms I need to know if I wanted to build such a system? Is it a good idea in the first place to use PHP? Is there something I'm not thinking about? What other languages can I use, perhaps in conjunction with PHP?
I am not saying that you have to abandon PHP, but you need different technologies here.
Let's start off simple (without Akamai :-)) and think about the implications here. Video, chat, etc. - it's all client-side in the beginning. The user has a webcam, you want to grab the signal somehow and send it to the server. There is no PHP so far.
I know that Flash supports this though (check this tutorial on webcams and flash) so you could use Flash to transport the content to the server. I think if you'll stay with Flash, then Flex (flex and webcam tutorial) is probably a good idea to look into.
So those are just the basics, maybe it gives you an idea of where you need to research because obviously this won't give you a full video chat inside your app yet. For starters, you will need some sort of way to record the streams and re-publish them so others see other people from the chat, etc..
I'm also not sure how much traffic and bandwidth this is gonna consume though and generally, you will need way more than a Stackoverflow question to solve this issue. Best would be to do a full spec of your app and then hire some people to help you build it.
HTH!
Please note that the below described service is no longer available as
it was based on FLV media (Flash)
This project which utilizes the Red5, Flex and PHP for Live Video Streaming and Recording has many features
Stream Live video to the viewers
Record the streams from your cam or other video input devices to the server
Preview the recorded streams and files and thumbnail the frame which you would like to display for the video.
Upload the videos from your computer and convert them to FLV which can be streamed using Red5 .
Choose from any resolutions
Can be plugged to any script
Each website user can have a separate Directory for storing their videos and thumbnails use this link
http://code.google.com/p/red5-flex-streamer/
PHP will let you build the pages of your site that make up your video conferencing and chat applications, but it won't deliver or stream video for you - PHP runs on the server only and renders out HTML to a client browser.
For the video, the first thing you'll need is a live streaming account with someone like akamai or the numerous others in the field. Using this account gives you an ingress point for your video - ie: the server that you will stream your live video up to.
Next, you want to get your video out to the browsers - windows media player, flash or silverlight will let you achieve this - embedding the appropriate control for your chosen technology into your page (using PHP or whatever) and given the address of your live video feed.
PHP (or other scripting language) would be used to build the chat part of the application and bring the whole thing together (the chat and the embedded video player).
Hope this helps.
PHP/AJAX/MySQL will not be enough for creating the live video streaming application There is a similar thread here. It primarily suggests using Flex or Silverlight.
For live video conferencing you can't ignore the need of a streaming server.
Yes, flash will let you display video from a webcam within the local flash control, but that won't let you then send that video over the network - for that you need a streaming server to send it to.
If you're going to build something like this it's prudent to think about how you're going to host the video from a very early stage as it will influence how you build the application. Flash/Flex/Silverlight/Windows Media....etc....
There are a lot of "off-the-shelf" 'servers' that will run in your environment.
Most of these utilize the aforementioned Flex or Silverlight to implement the actual video itself but I'm pretty sure all will run under LAMP/PHP.
The challenges will picking the best software from everything that's available and getting your hosting-provider to let you stream video (it goes without saying that streaming is heavy on bandwidth).
You can easily build a website as per the requirements. PHP will be there to handle the website development part. All the hosting and normal website development will work just as it is. However, for the streaming part, you will have to choose a good streaming service. Whether it is Red5 or Adobe, you can choose from plenty of services.
Choose a service that provides a dedicated storage to get something done right. If you do not know how to configure the server properly, you can just choose a streaming service. Good services often give a CDN that helps broadcast the stream efficiently. Simply launch your website in PHP and embed the YouTube player in the said web page to get it working.
Same problem/answer here, quoted below
I'm assuming you mean that you want to run your own private video
calls, not simply link to Skype calls or similar. You really have 2
options here: host it yourself, or use a hosted solution and integrate
it into your product.
Self-Hosted
----------------- This is messy. This can all be accomplished with PHP, but that is probably not the most advisable solution, as it is
not the best tool for the job on all sides. Flash is much more
efficient at a/v capture and transport on the user end. You can try to
do this without flash, but you will have headaches. HTML5 may make
your life easier, but if you're shooting for maximum compatibility,
flash is the simplest way to go for creating the client. Then, as far
as the actual server side that will relay the audio/video, you could
write a chat server in php, but you're better off using an open source
project, like
janenz00's mention
of red5, that's already built and
interfacing with it through your client (if it doesn't already have
one). Or you could homebrew a flash client as mentioned before and
hook it up to a flash streaming server on both sides...either way it
gets complicated fast, and is beyond my expertise to help you with at
all.
Hosted Service
----------------- All in, my recommendation, unless you want to administer a ridiculous setup of many complex servers and failure
points is to use a hosted service like
UserPlane or similar and offload all the
processing and technical work to people who are good at that, and then
worry about interfacing with their api and getting their client well
integrated into your site. You will be a happier developer if you do.

Categories