Rather than use ping, I like to fopen a simple PHP file on the remote server. If the remote file correctly returns some message that's stored in a database on that server then I know that:
1. the server is running
2. apache is running
3. php and mysql are running
Read the manual at php.net for the fopen command to see how to retrieve a file from a remote server. Then on your main server, your script can do one fopen for each remote server and you will know whether or not each server is working.
Ideally, you'd run this once every 5 minutes as a cron job and store the results in a local mysql table. This is more efficient. For example, if you have 6 mirror servers and you got 100 visitors in five minutes, you're still only making 6 fopen commands every 5 minutes instead of 600 (100 visitors X 6 servers) fopen commands which wastes time, bandwidth and cpu on all your servers.