I'm new to phoneGap and I just found out, It doesn't accept php scripts.
My problem is I have a php script that returns information from a database.
When I convert the .php script to a .html script(with embedded php), the information is not returned to the browser.
What can I do to fix this ?
According to the PhoneGap FAQ, you can't use PHP with it:
Q: Can you use PHP/ASP/JSF/Java/.NET with PhoneGap?
A: A PhoneGap application may only use HTML, CSS, and JavaScript.
However, you can make use of network protocols (XmlHTTPRequest, Web
Sockets, etc) to easily communicate with backend services written in
any language. This allows your PhoneGap app to remotely access
existing business processes while the device is connected to the
Internet.
Related
I have an application that retrieves some info and give them to user from a certain public website. However, i am not sure whether i should let my app immediately connect to the target website or it should get the info through my web server using a simple PHP script (JSON).
Actually I am using Jsoup to get the information and I tried both and they worked perfectly ( immediate and PHP) using Jsoup. However, I have not published my app yet due to the confusion aforementioned.
Use the web service. If your client has logic to parse the HTML, it can break when the web page changes. The web service can absorb this change and make corrections, but your client cannot. Not unless you release another version of your app, and that can be a pain.
I have a php page which connects an API and gets information back which can then be displayed.
I'd like to turn this into an app for Android. I've heard of PhoneGap, which I know uses javascript, html, and css. I know javascript is capable of calling php files, but I am unsure how or if its even possible to call a php file from an android device. I'm not sure if android browsers can handle php, or what the deal is with them. So if you have any information on that, I'd appreciate it.
I'm also willing to rewrite the API call in javascript, but I don't think thats possible. If you think differently, please let me know what you're talking about.
Android cannot talk directly to PHP. What phonegap, javascript, etc.. are doing is simply issuing HTTP requests that happen to be handled by a PHP script.
The PHP code will execute, output some data (json, html, xml, gif, jpg, etc...) and send that out as a the HTTP request's reply.
PHP is just a server side language so it doesn't matter if your browser "can or cannot" handle it, only HTML is returned (unless you set a different content-type).
You may be worth while looking into REST style JSON api's which would allow a XMLRequest to be sent to. Have a look at this document
Theres also a nice tutorial here which shows how to call a REST API and a PHP Tutorial here to create a REST API.
1.It dosent matter to PhoneGap where the PHP is hosted or Its PHP OR ASP.NET OR ASP.NET MVC
2.If You wanna host your PHP code yourself in production (You mayb shouldn't do this in production). then you need a server and a static IP address
3.if you just wanna setup a PHP server for developmental purposes then just tie it to 127.0.0.1:81 and you can directly use this address it doesn't matter whether you have a static IP address or not.
I have done this with phonegap using jsonp
http://en.wikipedia.org/wiki/JSONP
Works great
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.
I have the Sharepoint Intranet server on the same nework as the Internet PHP Web server. I would like to know if via PHP SQL code I can access a collection list of PDF files from the intranet so it can be viewed on the Internet site.
SharePoint exposes a Lists web service to access List Items from a SharePoint List/Document Library. You should be able to use this to grab document URLs and get that as a byte array or something, which you could serve up in your PHP application. I'm not familiar with PHP, so I don't know what kind of web service support is offered, but you could always do it client-side with AJAX.
I have a large array of vehicle make and model data that I want to dynamically display on a web page. For example, when you select a vehicle make from a drop down menu the vehicle model dropdown is dynamically populated with an asynchronous call.
I would normally execute this with an AJAX call to a PHP script that would return the desired data from a server side database.
To remove the need for a PHP helper script, I would like to directly call a server side SQLite database.
Everything seems to indicate that server side SQLite databases are not meant to be queried with Google Web Toolkit or JQuery.
Is it possible to use a server side SQLite databases with Google Web Toolkit or JQuery?
Thanks as always!
a couple of datapoints:
both GWT and jQuery ultimately execute as JavaScript inside the browser. they don't have any access to the network stack beyond being able to initiate AJAX requests (HTTP).
SQLite isn't a server, it's a library embedded inside an executable. Most modern scripting languages (like PHP, Python, Ruby, etc) embed it in some library (either core or external).
both HTML5 and Google Gears use SQLite to provide client-side data storage to client-side JavaScript apps; but it's all running inside the browser and therefore fully client-side.
so.... there's no 'direct' route between GTW/jQuery to server-side SQLite
You might want to check out Google Gears. It integrates GWT and SQLite, so it might give you some clues and some sample code as to how this might work with an online application:
Google Gears is a library that enables
your web applications to work offline.
Currently it consists of three
modules: LocalServer for caching and
serving up your web app resources (ie.
html, javascript, images), a SQLite
Database for storing offline data, and
a WorkerPool for performing
asynchronous operations.
http://www.gwtsite.com/getting-started-with-gwt-and-google-gears/
There is a JDBC driver for SQLite, so you can provide (abstracted) access to this via GWT's RPC.