Angular2 and xampp server - php

I want build web application using angular2 with MySql database on xampp server and php by server side. Is it posible? How start do this and connect to server? Thanks for answers and advices!

It is quite similar to how I develop with Angular 1 and PHP on a LAMP installation. It is possible of course. Angular 2 (when transpiled) is your client side code. With Angular you can call PHP-services. For example, I created PHP services that encode/decode JSON and read/write from DB's. So the PHP is server side and talks to the DB, Angular is client side and talks to the PHP services via REST.
This url explaines using databases with PHP very well: https://www.binpress.com/tutorial/using-php-with-mysql-the-right-way/17
An addition: Making Rest-API's of your PHP modules also requires you to secure them. If you have an API that updates your DB, then anyone can call it and ruin your application. Since Rest-API's are http calls you can use basic authentication with SSL to secure them.

Related

Connect react native to an existing php and mysql project

So I currently have a website built with PHP and MySQL that is hosted by a provider similar to GoDaddy (called "XSERVER" or "エックスサーバー").
I've been trying to connect the MySQL server to a react-native project so that I could GET and POST information from my app, but I haven't had any luck.
The hosting company does not allow node.js to be run on their servers, so the option of express.js was eliminated.
what other option could I take to connect a PHP and MySQL server to a react-native app?
Sorry for the general and ambiguous question, I genuinely don't know who to ask or if I should give up.
The website: https://kasumushi.com/
You have many options to create an API with MySQL and PHP. This API can then be used in your React native application. You should incorporate some sort of auth mechanism to be sure that only your react app can interact with the API.
Either create one from scratch, or use a REST API framework

Build webservice for both website and app

I've developed an android app that interact with my database by using some php scripts (one for each function of my app) that returns a json object with response data.
Now i need to build up a website too that do the same tasks of my app, but i would fix up my server code.
Should i have to maintain my app php scripts separate from website scripts (i'm planning to use some php framework to develop it), or there's a different way to do it?
No! Same script will work for all platforms.
If you follow proper protocols you will be good :)
Use Rest Console or similar tools to test your webservice on browser.
If you are able to get JSON response, then its good for all platform.
If you want to separate out the platforms and devices on server that can be handled by using user agent check at server end.

Php in phone gap application

We have to develop an application with more plattform. We would use the framework PhoneGap. For our application we need services of backend, the question is: Does PhoneGap support PHP?
If it doesn't support PHP. In which way we can solve the problem?
The most important thing is: make call server
(Get and Post), parsing a json and other functions
that PHP gives.
Phonegap does not have a server. You need to call via Ajax to remote servers.
The backend can be in any language which supports HTTP calls, as PhoneGap is an independent client.
You can use PHP to write an API for use within your Javascript PhoneGap application.
I can recommend the Laravel framework to accomplish this.
Yes...you can use PHP or any PHP framework to give backend for mobile app made using phonegap/cordova....point is phonegap/cordova app will be on client mobile which won't understand PHP embedded in phonegap html files....so write an API amd place it on a server and then make AJAX calls to server to do database and other backed operations
Try to return JSON data from the PHP API.....it's a famous data structure and supported by many applications

Connecting MySql with Android without using PHP

I want to connect a MySql DB with my android application.
However, I DON'T want to/CAN'T use PHP for doing this.
Almost all solution for MySql connection with android on internet uses PHP.
I read somewhere that, If one don't want to use PHP then web service should be used.
But I'm not able to find any tutorial/sample example for the same.
Any help appreciated.
It seems you're mixing up some things.
A web service is simply some code on the internet (web) which allows you to receive and send information to a server, where it is saved per example in a database.
PHP is just a language, in which you can write a web service.
You can use a vast array of languages to create a web service ( read: expose your database) to other devices. Among others, you can easily do this in Java, .NET, Python ...
If you're looking for a way to connect to an external database without any web service / API in between, i'll have to disappoint you with the news that this is not supported by Android.
Most examples of a simple web service / a bunch of scripts contain PHP since this is probably the easiest and can be used on pretty much any server.
A webservice, is as it's called, a service, meaning that you have one side consuming it (the android client). if all you want is a persistent storage, you could use SQLite which is an SQL compliant solution which exists within android.
If it's possible to SSH to a server via Android, you could use that to connect to mysql, because the only other solution involves having mysql binaries installed locally on your android machine, and that's not possible AS FAR AS I KNOW, on Android.
One major reason for using a webservice (e.g. written in PHP) to connect to a remote DB is that you don't want to store the database login credentials inside your app. Because otherwise it'll be easy to extract your login for that database and access and edit it in a way you might not have planned (eg. delete stuff).
Its Possible to connect mysql database .
I have done with out using php file . I have used an spring configuration file to establish an connection to the database and dao to access the data from the database.
Create an Web Application that access the Server through the Spring Framework and an Servlet .
Create an Android Client Application tat make an get / post request to the Servlet , process the results in the servlet and return the response to the Android Client Application (json format ) Process the json format reponse in the Android Client Side and use it to your application

Chat room app on Android without openfire

I plan to use asmack lib for a chatroom app on android, however, I just want to use PHP as server scripts with mysql as backend database server. I hope I can find a way to build it without openfire, is it possible? Any suggestions to implement them?
You can use whatever server you want. asmack is a client library that communicates via XMPP, which is language agnostic. Select any server you would like and your client should work fine.
Your comments about whether OpenFire has a PHP api though are somewhat confusing, do you want an OpenFire server or not? The language the server is written in is irrelevant to your client app.

Categories