azampagl Posted February 24, 2008 Share Posted February 24, 2008 So here is my question / problem... I have an external site (let's call it site 1) that needs to remotely connect to an Access Database on a remote server (lets call it site 2). This access database can only be accessed by scripts on the server (its in a secure, non-public directory). My thought was just create a PHP script on the remote server (site 2) which let me access the information I needed through a function, and I would use another php script with the include or require once function to access it (on site 1). So what I'm getting at... Any one know any good tutorials for making secure SSI for remote access. Quote Link to comment Share on other sites More sharing options...
btherl Posted February 25, 2008 Share Posted February 25, 2008 include() and require_once() are not really appropriate here. In any case, all you will be able to access is the output of the remote script, not the functions within the script. What you can do however, is have the remote script take the necessary arguments, and return the output your script needs. So the script itself is like a single function (or many functions, with an argument to select which function). The simple method here is to use functions like file("https://remotesite.com/script.php?arg=foo"), providing your php supports https wrappers. The more complex but more configurable method is using Curl (about which much information can be found through google, and in the forum here). Quote Link to comment Share on other sites More sharing options...
Bauer418 Posted February 25, 2008 Share Posted February 25, 2008 Ensure that the script on server 2 checks to see where the request is originating from, validating that it is from your first server's IP address. You may also want to employ an array of other checks to ensure your data's security. Quote Link to comment Share on other sites More sharing options...
mainewoods Posted February 25, 2008 Share Posted February 25, 2008 you want to call the php page on the second server from the first server using the file_get_contents() php function: http://us2.php.net/manual/en/function.file-get-contents.php if that doesn't work on your server because 'fopen wrappers have not been enabled', then use the curl library to make the call to the second server: http://us2.php.net/manual/en/ref.curl.php The advantage to using curl functions is that you can encode normal form fields to send as your security tokens which will keep them off the url. if you are returning quite a bit of data, you might consider wrapping it up in xml before transmittal using the simpleXML functions: http://us2.php.net/manual/en/ref.simplexml.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.