You need to write PHP scripts for both servers.
The script for the local server is simple: use a command like fopen / fread to connect to the script on the remote server. If you receive a message "Ok", then you know that the remote server is up. Write a crontab to force this local script to run once an hour, once a minute, whatever you feel is necessary.
The script for the remote server should start with a print statement that prints "Ok". This way, the only way the local server could possibly hear that message is if (A) the remote server is up and (😎 if PHP is working. If either of those things aren't the case, then the print statement won't work and the local server hears nothing.
The only script that is able to write a file to the remote server is the script on the remote server. After it prints "Ok", then use fopen / fwrite (with the append flag) to write the status to a text file that is on that remote server. You can use the date() function to find the current time so that you can write that information to the log file that you are building.