To connect to remote server from your local machine you need some
privileges on that server itself with your
IP and an username with a prespecified
password. So you can't do it without their permission.
Check this answer
After that you are allowed to create connection to that remote database
server using the following syntax:
$hostname='www.facebook.com';// Remote database server Domain
$username='username';// as specified in the GRANT command at that server.
$password='password';// as specified in the GRANT command at that server.
$dbname='testdb';// Database name at the database server.
$mysqli = new mysqli($hostname, $username, $password, $dbname);