javascript - Retrieving data from database using PHP script on different server -
so trying find solution bit of tricky problem.
i need data postgres db use in script on server 1. server 1 not have postgres libraries installed.
server 2 has postgres libraries installed. write script on server 2 retrieves information after having been passed correct parameters. although not sure hot info server 1.
am right in assuming cannot use include cross-domain? security wise etc.
i considered using javascript , modal dialogs (we use old old ie) open page , return data via window.returnvalue, seems messy , convoluted.
is there better way of doing this?
update: found solution
i created web service on server 2 run query required, , return results, called server 1.
is there better way of doing this?
yes, there better way, use api that. 1 can take @ apigility (https://www.apigility.org/) have start.
in short: on server 2, implement api handles request (and not forget security auth , on) , resturns it. server 1 sends request api on server 2 , gets answer there.
i hope, guide in right direction.
there solution: can open server 2 not answer querys localhost server 1 too. not safest way, possible, can query server 2 directly server 1 (just enter it's dns in db-config).
Comments
Post a Comment