Hello,
I have a php script that is suppose to be checking http status code for submitted URL and return status number.
Please see the code.
When I run it on a local machine it is working well.Code:#!/usr/bin/php <?php $url = 'www.google.com'; $connection = curl_init($url); curl_setopt($connection, CURLOPT_TIMEOUT, 30); curl_setopt($connection, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($connection, CURLOPT_HEADER, TRUE); curl_setopt($connection, CURLOPT_NOBODY, TRUE); curl_setopt($connection, CURLOPT_RETURNTRANSFER, TRUE); curl_exec($connection); $http_status = curl_getinfo($connection, CURLINFO_HTTP_CODE); curl_close($connection); echo "\nHTTP Status: $http_status\n"; if ($http_status == 200 || $http_status == 302) { echo "Site is ok\n"; exit; } else { echo "Site is not ok\n"; exit; } ?>
If I run in on the server via console it returns error:
"Operation timed out after 30 seconds with 0 bytes received"
I have tried the same script on two other servers (via console) and it works.
I have problem with one server only.
I have checked php.ini on booth servers and they are exactly the same.
I have changed httpd.conf file for Apache they are exactly the same.
No idea what can be wrong.
Any Idea guys?
Thanks!
Regards


Reply With Quote

Bookmarks