Reputation: 33
I have a cron job that calculates the disk space on ServerA
I have a MySQL database on ServerB that stores the disk space values
ServerA in not allowed to access MySQL database on ServerB (Rules out direct MySQL Connect)
ServerA cannot open files on ServerB (Rules out include();
)
ServerA and ServerB have no shell_exec()
abilities
I've tried header("Location: http://ServerB.com/record.php?disk_space=$disk_space");
using a get method then the receiving file $_REQUEST
the values but it only works when run through browser and not when run as a cron job.
I think there are no proper alternatives. But I'm happy with a peculiar or scruffy solution. Please put forward your ideas. TIA
Upvotes: 0
Views: 84
Reputation: 81
create a file with an extension of php and write your script with mysqli_connect, etc and handle what you want to do as if you go the this page on your browser yourself than run cron job of that file , that should do it.
Upvotes: 0
Reputation: 14282
You can hit external scripts directly through a number of HTTP libraries -- as well as file_get_contents()
.
See:
You could even use sockets to make the request:
Lots of options (more than included here). Easiest, if your needs are simple, is just file_get_contents
.
Upvotes: 2