Setting up URL for a webservice - php

I'm trying to plan out a mobile application (iOS) that has to connect to a remote database. After doing some research, I found that I'd have to connect to the DB by using a PHP framework.
I learned this from reading multiple articles, but I specifically got my information from this stack overflow question: How to connect mysql with swift?
What I'm confused on is how I can set up the URL for the web service. How is this accomplished? Is this some sort of server you pay for? Can you set the URL to be the same as your remote database server?
For example, in the last piece of code in the linked stack overflow answer, the user had:
//URL to our web service
let URL_SAVE_TEAM = "http://192.168.1.103/MyWebService/api/createteam.php"
What exactly is this?
I think I am misunderstanding a concept here.

"192.168.1.103" or "google.com" identifies a server (PC) on the local network or on the internet. It is either your own PC or a rented one from some hosting provider. I would suggest the following steps:
Identify what platform do you want to use as your remote database. I see you are quoting some text about mysql, but there are a lot more choices. You could look into noSQL databases like CouchDB or you could use just a file with text hosted somewhere.
Based on the platform you can check where you could buy hosting for your database. I could suggest looking into Amazon AWS, they can provide you a free Linux PC, where you can host MYSQL server or CouchDB server or even a simple file server to host your data. You can also first try to install corresponding server to your local machine (e.g. to the same one running iOS emulator) and try to connect using http://localhost address (url).
Connect to the corresponding server from your iOS App and write logic to read, update, create, delete data if it is needed.

Related

What kind of remote server service was I using?

I’m part of a very small company that uses a database hosted on a server (104.131.##.###). However, the server no longer responds and the person who set up and owns the server space has already left the company. This past employee seems disgruntled so they won’t help. It’s complicated, but we decided to open a new server. The only issue is, I don’t know what we were using.
What I do know is I would access and change the database at http://104.131.##.###/phpmyadmin/ (image of login below)
I also had php files stored on the server using Filezilla (in a “var” folder, if that helps) which were accessed via path: http://104.131.96.###/path/to/file.php
I’ve set up a version of the same server using xampp on my own computer, but I can’t keep my computer running constantly.
So my question is, what service were we using / should we use? Where would I start to set up a new server like this? (I still have the php files and can recreate the db)
I've looked into AWS and digitalOcean, but I'm in a bit over my head and can't tell if they're offering what we need.
Any help would be appreciated. Thank you
The server was using phpmyadmin and mysql and Digital Ocean.
So you need at least a LAMP stack. With the info given we can't help you more.

Using my php scripts in Android to access database

I need some major help in setting up my android app to add/receive data to/from my database. I'm using Amazon's RDS service in connection with xampp's phpMyAdmin. I've already successfully connected my DB instance to the database in phpMyAdmin. Also, I've written my php scripts to do basic CRUD (Create, Read, Update, Delete) commands in SQL. I've been following this tutorial.
The problem for me is, in his tutorial he is using strings like this:
private static String url_all_products = "http://api.androidhive.info/android_connect/get_all_products.php";
to run his php scripts in a call to makeHttpRequest(url_all_products). But I don't have my own website to do this and I'm pretty sure I don't need one to do this.
Next, I have a test.php file that does a simple echo statement and it works when I run this in a web browser:
http://localhost/phpfiles/test.php
Which leads me to my second problem. I don't want to use localhost because I need these php files and the ability to retrieve data from the database to be accessible to anyone using my app. This is the sole reason I'm using Amazon's RDS service so my database can be accessed on the cloud.
So how can I use the host address provided to me by Amazon RDS to access the database and where do I store all the php files so I can properly use them in Android the way the tutorial shows? They are currently saved in xampp/htdocs/phpfiles/.
I feel like I'm missing some fundamental understanding of all this and I'm going about it all wrong. If someone can point me in the right direction that would make my day.
It sounds like you don't really need the XAMPP install on your local machine at all. You're hosting this on Amazon and you want it to be available to the internet, so your local computer isn't involved. You can use XAMPP locally for testing and development, but for production use you'll be exclusively on the Amazon RDS cloud.
But I don't have my own website to do this and I'm pretty sure I don't need one to do this.
You may not want a website, but you do want your services hosted on the internet. That's what your RDS instance is for, and technically the tutorial is referring to an API which happens to be exposed through a web page. This is a much better idea than opening MySQL directly to the internet on port 3306.
You'll then use your Amazon host — for which you really should use a FQDN such as api.example.com rather than the IP address, but the IP address will work just fine from a technical aspect.
The files you refer to are on your local XAMPP installation; in the xampp/htdocs/phpfiles/ folder, and need to instead be on the RDS instance.
Then your application accesses the API you expose in those files which return information back to your application.

Remotely managing a mysql database as a limited user

I have a mysql database at my web hosting service, which I would like to access from a C# application on my local computer.
Due to account restrictions, I can't enable remote connections on the database server.
I would like some suggestions on how to execute CRUD operations on the database remotely i.e. from my localhost or any other place which is not on the server itself. The first idea that popped in to my head was to create a PHP REST API on the server and let it do the database work.
Is that the way to go? If so, is there anything similar created already, or do I need to make it from scratch? Perhaps you have other ideas?

How to connect VB.NET to Web Host

Basically, I want to create an application like this:YOUTUBE
I want to create an application that when I add some information from my web host (either PHP or MYSQL) VB.NET will read it.
From your website you'll need to insert the data into your MySQL database.
The problem with using the database provided by your web host is that the chances are, due to 'Security Reasons' the will have disabled external access.
This means that any files outside of your web server (your sites root/sub directory) will not be able to access the data. So, while your website will be able to connect without a problem, your program will not.
Some hosts give its customers the opportunity to add an IP address to a white list which enables them to bypass their security system. However, most will not give you this option.
My suggestion is that you either rent a VPS where you can run both the WebServer and Your MySQL database (and PHPMyAdmin) from or Set Up A MySQL database on your PC (its not that difficult just read the manual and youll be fine). If you had a VPS then you would no longer need your pre hosted webserver as you could run your own. You would need to point your domain name to your VPS webserver. It will act just like any other.
By running your own MySQL Databse you are given the option to enable remote access. This means that any external entity with the correct details will be able to connect.
If you cant get a VPS or don't want to run your own server or rent a server that allows for external access. Check out db4free.net .They provide you with a free MySQL Database with external access for Developers to test out their systems. They are not ultra fast so that's something you may want to be aware of. Another thing is that your data that's held can be removed at any time. The servers are not there to be used permanently just for testing.
So how do I connect to it through VB???
Good Question! To establish a connection, I suggest you use MySQL.Data library provided my DevMySQL themselves and import it into your program. Done so by Imports MySQL.Data.MySQLClient. This is written by them to work with their databases. Yes you can connect using some of the functions already in VB but in my opinion they don't work as efficiently. You'll need to download the MySQLConnector to connect as well.
Hopefully That Answers Your Questions. Any Problems Just Comment below!
Regards
Joe

is it possible to create a system that is connected a website with the same database

Good day. I have a thesis project. it is composed of a webpage created on php and a system using vb.net 2008.
As of now , they are both connected to the same database.
I am wondering if it is possible that if i packaged the system and live the website, will still be connected with one database? Thank you in advance.
If I understand you right (and the question could be better worded), you're asking what happens if you deploy the website on a different server than the one you used to develop it. The short answer is that, unless the machine hosting the database is accessible to the web server host machine, that you would also have to redeploy the database.
In other words, wherever you move the PHP-based website and VB.NET system, they would need to be able to access the machine hosting the database server. Otherwise, I see no issue with them both accessing the same database.

Categories