i’ve got to connect 2 php pages on 2 different servers,
in the first server there’s the DB (mysql) with an “email” table, generated by a php page..
in the second server there’s a php file wich needs to read the “email” table…
the second php page doesn’t need to be opened by the user
the fact is that i need to make this work with lots of DB, not just one
so i can’t store the mysql connection params in the php page on the 2nd server and just open it… i’ve got to pass the connection params every time
For now i use something like this, on the 1st server php page:
$socketcon = fsockopen("http://www.server2.com",80,$errorno,$errorstr,10);
if($socketcon) {
$socketdata = "GET page2.php?dbuser=xxx&dbpass=xxx&db=xxx HTTP/1.0\r\nHost: http://www.server2.com\r\nConnection: Close\r\n\r\n";
fwrite($socketcon,$socketdata);
fclose($socketcon);
}
but i fear that putting the params in URL is soooo bad….
any idea ?
One way to do is to create a “public” webservice with PHP that will receive credentials. If the credentials match you reply with the data you need (maybe in XML format). Of course all of this is over HTTPS. You can then “talk” with the service with CURL to create you DB connexion.