Re: Remote MySQL connection via PHP file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 12/1/2006 10:17 AM, Scott wrote:
For a project of mine, I need to keep the connection information to a MySQL server database on another server.


I'm sure there are more efficient ways to do this, but here's a fall-back:

Write a PHP program (web service) to run on the server where the database is located. From the other server, make an HTTP request that includes the connection details (obfuscated), some sort of password that can verify the authenticity of the requesting agent, and either the literal SQL query or a symbolic pointer to a stored query.

http://example.com/sqlservice.php?u=HJDFH&p=hglkdl&a=1095673263&q=members
or
http://example.com/sqlservice.php?u=HJDFH&p=hglkdl&a=1095673263&q=SELECT%20Firstname...

The web service validates the request and returns the dataset, in XML, as a serialized array, or in another easy-to-use format, for the requesting program to parse and utilize. The first thing I'd put in the return dataset would be a status code to communicate MySQL errors, perhaps also num_rows for SELECT queries to reduce the number of trans-server requests necessary for typical jobs.

Regards,
Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux