Ahsan Abbas
Ahsan Abbas

Reputation: 73

How to get PHP page in Phonegap build?

I have a website made with .php pages. They bring data from the database and then insert into the required areas. However I am trying to make a phonegap app with the same code. Is it possible that I call the PHP pages via AJAX from the app and then present it in the view? I don't know any other way though.

Any suggestions? I don't want to change the code to completely JavaScript because we're near the end of the project.

Upvotes: 1

Views: 815

Answers (1)

user3255670
user3255670

Reputation:

@Ahsan What you are asking is possible, but you need to rethink you strategy.

  1. Are you aware that both Google and Apple frown on apps that are website wrappers?
  2. Phonegap is not a webserver or a webbrowser.
  3. From Phonegap FAQ

    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.

This FAQ should also help.
Top Mistakes by Developers new to Cordova/Phonegap

Addendum 2016-03-21 This response answers the implict question.
Convert PHP website to Phonegap application [on hold]

Upvotes: 2

Related Questions