To connect to a remote server from your local computer, you will need the one already provided privilegeson this server with your IP and username with a predefined password . Therefore, you cannot do this without their permission.
Mark this answer
After that, you can create a connection to this remote database server using the following syntax:
$hostname='www.facebook.com';
$username='username';
$password='password';
$dbname='testdb';
$mysqli = new mysqli($hostname, $username, $password, $dbname);
source
share