I want a secured and server side way of interacting with two different servers namely SERVER A and SERVER B

and i want database details and queries done on server B without reveling this database details to server A but yet server A functions based on responses it got from database queries in ServerB

Then ServerB can only make a query search using data sent to it from Server A and then return a response to ServerA to know what else to do based on response it got from serverB.

Am thinking curl_init() or Api calls but not ajax call or JavaScript. Anything server side language is okay.

My objective is this:

  1. The database in server B should not be know to serverA where the form is, if not i would have just added the database details inside the form in website A, since is all about quering a database and getting a result.

But I want a way of hiding database querying php file in serverB so server A don't know which database was queried all it needs to know is if result returned from server B is Yes then do, but if returned result is No then do that. So anything server side interaction or call is most preferred, not JavaScript or ajax.

  1. The second task is to have a way to make a php run in an external server following response from another server or website.
    Example, an email sending php file is on serverB but it only execute or send emails when ever serverA makes a call to it.
    And probably Server A should be able to send which email address that serverA should send the email to.

A simple illustration is ServerA telling a php file in ServerB to send email to this email address. The email address to send the email to will come from a form submitted on ServerA

Recommended Answers

All 2 Replies

Building an API using the language of your choice can accomplish what you require.

Server A can never know what is going on in Server B database unless you chose to. Sending request from Server A to B does not reveal your Server B database though it depends on how you are sending the request. But the best way is to avoid querying your Server B database from Server A.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.