Jump to content

Call a php script on another server?


rabbit_fufu

Recommended Posts

Hi everyone, hoping someone here can point me in the right direction.

I'm writing a couple of php scripts for creating temporary urls for file downloads.

Here's how it works, sort of...

There are 2 files: generate.php & download.php

generate.php creates a hash that references the file to be downloaded.

Then, when the hash is passed to download.php like so...

download.php?hash=thehashstring

The file is fed to the browser.

No problem so far. Here's the catch...

I need to call generate.php from a script on a completely different server, something like this...

Master Script on Server A calls generate.php script on Server B...
A new hash is returned to the Master Script on Server A by generate.php on Server B...
Master Script on Server A then ouputs the download url using the newly generated hash.

I'm a bit unclear just how one goes about this in php -- having 2 scripts talk to each other on different servers. Also, I will need to set this up in such a way so that it is relatively secure. IOW, generate.php will only generate and return a new hash if it is being called by the Master Script on Server A. (If it is called from a different server, or directly through a browser, then it wont generate a new hash.)

Any suggestions as to how to best achieve this would be much appreciated.

Cheers!
Link to comment
Share on other sites

What you can do is link both servers together with a MySQL database (making them both access the same db). Then you can access anything generated by a server on another, and the user won't even realize that.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.