phpknight Posted June 30, 2007 Share Posted June 30, 2007 Ever since I got a server for our site, it just opens new issues. Here is the problem: My SSL Cert somehow got corrupted. The server is managed, so they fixed it right away once I noticed it, but nobody was able to checkout until it was fixed, and I cannot check the site every hour. Here is what I want to do (but the server people say it is not possible): Is there a way, by chron or otherwise, to run a PHP that requests a secure page, and if it does not respond, it emails a warning? It seems that this should be able to be done without too much trouble. Any ideas? Quote Link to comment Share on other sites More sharing options...
ignace Posted June 30, 2007 Share Posted June 30, 2007 yes that is possible, however i am not really experienced into cron, however after asking my friend google for some advise, he gave me these results: http://www.unixgeeks.org/security/newbie/unix/cron-1.html http://www.aota.net/Script_Installation_Tips/cronhelp.php3 greetz, Ignace Quote Link to comment Share on other sites More sharing options...
phpknight Posted June 30, 2007 Author Share Posted June 30, 2007 Thanks. I am fine with the cron part of it, but how would I begin to do that in PHP? Quote Link to comment Share on other sites More sharing options...
phpknight Posted July 1, 2007 Author Share Posted July 1, 2007 *bump* Does anybody have any PHP advice for this topic? Quote Link to comment Share on other sites More sharing options...
utexas_pjm Posted July 1, 2007 Share Posted July 1, 2007 I'd try something like this: Create a test page on the server in question, i.e, ping.php this page is responding Then create a script which requests the test page every n minutes via cron <?php $url = 'https://www.yourdomain.com/ping.php'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$_url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $content = curl_exec ($ch); curl_close ($ch);\ if($content != 'this page is responding') sendAlertEmail(); ?> Best, Patrick Quote Link to comment Share on other sites More sharing options...
phpknight Posted July 1, 2007 Author Share Posted July 1, 2007 Patrick, Thanks for your help. I had to change the $_url to $url. This code works if I comment out that SSL_VERIFY_HOST line and use a normal URL. However, as soon as I put https:// and put that line back in, the content comes back as nothing, but it should have a string length of 24 (the line in the code plus the end line). Any ideas? Quote Link to comment Share on other sites More sharing options...
phpknight Posted July 7, 2007 Author Share Posted July 7, 2007 I got this to work by using the following two lines in addition to a few other changes: curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); I believe this will do the job. 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.