Flutter web must I http to mysql - php

Good day. I am new to flutter web. If someone can assist or point me where I can get the correct info I would appreciate it. I need to save data in mysql on the same server that the flutter web app is uploaded to. What I want to know is if I must do a http request even though the mysql and webapp is on the same server? I guess I need to create a .php file to post and fetch data from the mysql database. But if you are on the same server do you http to the .php or is there another way? Thanks in advance.

If you meant with "HTTP to MySQL", to directly from Front-end access MySQL through some Web-API, then no there is no such thing supported by MySQL.
But you can create your own Web-API Back-end (a .php script), which redirects requests to MySQL, and then Front-end only needs to communicate with said Back-end.
The Front-end may seem to be on same server,
but the Front-end logic runs on the user's Browser, which is far away from server.

Related

Load balancing (Distribution) with PHP and many servers

I am developing an app which has many users and (hopefully) will have many more in the future and therefore I want to get rid of my current one-server-makes-it-all solution to a many server structure. My app has customers in different countries and I want to handle each country with an own server. You can see this in the picture above. The app only knows the URL of the distribution server and I want to achieve, that the distribution server redirects to the right server.
How can I technically do this? I am using PHP / MySQL and my app is talking to my server with simple HTTP requests (GET and maybe later also POST) like
http://distributionServer.com/script.php?appCountry=us&work=getListOfItems
Server Sends back JSON data.
I have some technical questions:
how to make the redirect in PHP with all the parameters? The Servers that will finally handle the user need these params. Can I just make a simple redirect with "header()" ?
When I make redirect with header() does the communication still runs then over the distribution server? Because I don't want that all the "return" traffic is going over the distribution server, this server only needs to say "ok USA-App you talk to server USA". When server USA sends back data it should not go the way: ServerUSA -> Distribution Server -> App. Because these Server do not share a LAN, just somewhere in the net.
I know I could just hardcode the server URLs in the app so that US user always connect directly to USA Server but I need some flexibility to add new servers / change servers / change URLs / add new countries.. and I don't want to always update the app when something changed on the server side.
This is simplest way you can do this : https://support.rackspace.com/how-to/simple-load-balancing-with-apache/

how to make server who receive file from android app?

I am android developer and zero at back end process. Whats stuff/tools require for making a server/website that receives files from android app. I listen somewhere that php code is required as backend on server side. Is is true?
hoping for detailed explanation. Sorry for my english.
Thanks.
need php file for coonecting with database.use phpmyadmin(xampp)
tool for creating database.then create phpfile n post on server or localhost. after that use url in android.like our php link is localhost:80/phpproj/trial.php
and pass value to database using asyctask method.

Save form data from another server

I have simple Facebook app done right now (HTML+JS). User can just click and see some pages/products there but now I would like to add also form where they can leave their information (name + email). The app is currently hosted on my web partner server and I would like to still keep it there but where the information would be saved in future would be on different server. Now I'm worried about the security side. What is the best way to send the form data to another server php, process there and save it db? If this is even possible (should be). I'm more designer guy so I feel bit uncertain when comes PHP and personal information.
So make it short: Facebook app (HTML+JS) that is hosted on Server1. Server2 where I have database and where I would like to save the form data. Or would it be just easiest to move the whole app to server2 too?
You can use PHP on your first Server to write the data into your database on your second Server (using the correct connection). Then when you move your Website to the second server all your data will already be there and you wont need to move anything. If your second server is not yet available you can write the data to a database on your first server. Then when you want to move it to your second server you can export the database from your first server and import it on your second server. Then you will have to change your php to connect to the database on your second server.

Is it possible to send data to phpmyadmin from a windows/android application on a phone?

I am developing an application that needs to send data to a server so that the server data can be outputted on a website table.
My question is how is it done? I already know how to create tables and whatnot, but when a user creates an account on the phone application, how is it going to appear on the table on phpmyadmin?
# Zarathuztra convenient phpmyadmin is a tool to manage MySQL databases.
What you need is a script on the server that receives the requests from the smartphone is making special thinks inside. Save or manipulates the data in the database and sends the result back on to the phone. This is not the opinion, we can teach you on StackOverflow, sorry.
Watch out for cloud database services to your problem on the internet or ask are PHP-coder for help.

Is it preferable to retrieve information directly from one site or through my web server using php?

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.

Categories