Nura111
asked on
Why does the php monitoring website return false alarm
Hi I'm running a php script to check if a website is down and send an alert I got a lot of false alarm
so i tried it for other websites and
for exe you can try it with the following url:http://nurit.chicagonewshub.com/ and the word "This"
and the website is up but its return that its down. I think that it have to do to the fact the the website is taking more time to upload that the check is allowed if thats the case how can I add a more time to check.
I attached the script
Thank you!
so i tried it for other websites and
for exe you can try it with the following url:http://nurit.chicagonewshub.com/ and the word "This"
and the website is up but its return that its down. I think that it have to do to the fact the the website is taking more time to upload that the check is allowed if thats the case how can I add a more time to check.
I attached the script
Thank you!
function check($host, $find) {
$fp = fsockopen($host, 80, $errno, $errstr, 10);
if (!$fp) {
echo "$errstr ($errno)\n";
} else {
$header = "GET / HTTP/1.1\r\n";
$header .= "Host: $host\r\n";
$header .= "Connection: close\r\n\r\n";
fputs($fp, $header);
while (!feof($fp)) {
$str .= fgets($fp, 1024);
}
fclose($fp);
return (strpos($str, $find) !== false);
}
}
function alert($host) {
mail('youremail@gmail.com', 'Monitoring', $host.' down');
}
$host = 'www.catswhoblog.com';
$find = 'Cats Who Code';
if (!check($host, $find)) alert($host);
ASKER
I want to do it because I think its a good indication if the site is up. should I enter a timeout parameter somehow to the script (both yours and mine) for the time - the amount of milliseconds we will wait before considering your site down if yes how can I add that?
ASKER
Also when I tried your script it doesnt always work for me sometimes there is need to put / at the end of the url and sometimes not for it to work for exm:
www.nurit.chicagonewshub.com that is currently down
www.nurit.chicagonewshub.com that is currently down
The (float)0.5 is the timeout value.
Strange that the script doesn't work. When you put the same url in the browser you get the page correctly?
Strange that the script doesn't work. When you put the same url in the browser you get the page correctly?
<?php
$host = 'nurit.chicagonewshub.com';
$port = '80';
if ($check=@fsockopen($host,$port,$ERROR_NO,$ERROR_STR,(float)0.5))
{
fclose($check);
echo $host." is online";
}
else
{
echo $host." is offline";
mail('youremail@yourdomain.com', 'Monitoring', $host.' down');
}
?>
ASKER
I meant that for some websites you need to put the end "/" and for some not for order for it work. do you know anything about it?
So what is this timeout mean? that it will let the website 0.5 second to upload?
So what is this timeout mean? that it will let the website 0.5 second to upload?
The timeout, 0.5, is how long it will wait for a response before timing-out. In other words, if the website does not respond in .5 seconds, the script will report that the site is down.
I would recommend changing the timeout to something higher, like 5 or 10, to avoid false alarms; there may be times when the site is under heavier load and may take a few seconds to respond. Using a small timeout isn't really checking if the site is up, but more like checking to see that the site responds quickly.
I would recommend changing the timeout to something higher, like 5 or 10, to avoid false alarms; there may be times when the site is under heavier load and may take a few seconds to respond. Using a small timeout isn't really checking if the site is up, but more like checking to see that the site responds quickly.
Here is how I would change the script:
<?php
$host = 'nurit.chicagonewshub.com';
$port = '80';
if ($check=@fsockopen($host,$port,$ERROR_NO,$ERROR_STR,30))
{
$time = microtime(true);
fclose($check);
$timeToOpen = number_format(microtime(true) - $time, 6);
echo $host." is online (". $timeToOpen .")";
}
else
{
echo $host." is offline";
//mail('youremail@yourdomain.com', 'Monitoring', $host.' down');
}
?>
Sorry for rapid-fire posting...
You can add something in the "if" statement to check if the server responded in a certain amount of time. It could send an email if it takes more than X seconds to respond.
You can add something in the "if" statement to check if the server responded in a certain amount of time. It could send an email if it takes more than X seconds to respond.
ASKER
Ok ill try it i just saw a lot of falsh alarm from my script hope it will help just making sure the 30 (that send in the fsockopen) is in second? does that mean that it also take 30 second to see the website upload or its the response time from the server which is diffrent?
ASKER
So I Added that as followed I still want to look for the string why do you guys think its not good?
function check($host, $find) {
$str="";
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp) {
echo "nurit.$errstr ($errno)\n";
} else {
$header = "GET / HTTP/1.1\r\n";
$header .= "Host: $host\r\n";
$header .= "Connection: close\r\n\r\n";
fputs($fp, $header);
while (!feof($fp)) {
$str .= fgets($fp, 1024);
}
fclose($fp);
return (strpos($str, $find) !== false);
}
}
First, I must apologize: for some reason, instead of copying your (Nura111)'s code, I copied the code from Darude1234, which probably added some confusion. My bad.
It looks good to me. What I would do is always have it print out the response time, just to verify. So, here is my final code, using your original code along with your changes and mine:
The script is accessible from my test server as well: [ http://test.crazedsanity.com/EE/Q_27212881.php ]. Please let me know if you have any questions.
It looks good to me. What I would do is always have it print out the response time, just to verify. So, here is my final code, using your original code along with your changes and mine:
<?php
function check($host, $find) {
$fp = fsockopen($host, 80, $errno, $errstr, 10);
if (!$fp) {
echo "$errstr ($errno)\n";
} else {
$header = "GET / HTTP/1.1\r\n";
$header .= "Host: $host\r\n";
$header .= "Connection: close\r\n\r\n";
fputs($fp, $header);
while (!feof($fp)) {
$str .= fgets($fp, 1024);
}
fclose($fp);
return (strpos($str, $find) !== false);
}
}
function alert($host) {
//mail('youremail@gmail.com', 'Monitoring', $host.' down');
}
$host = 'www.catswhoblog.com';
$find = 'Cats Who Code';
$startTime = microtime(true);
$checkResult = check($host, $find);
$totalTime = number_format((microtime(true) - $startTime),6);
echo "RESULT OF CHECK: (". $checkResult ."), totalTime=(". $totalTime .")";
if (!$checkResult){
alert($host);
}
The script is accessible from my test server as well: [ http://test.crazedsanity.com/EE/Q_27212881.php ]. Please let me know if you have any questions.
ASKER
I think That my problem is diffrent beacuse when Im runing my script at a local host its working fine but when im running it on the real server that Im going to set a cron job from its seem like he the fscopen function return false and I think that's the problem. any suggestion?
ASKER
also in n your code you didnt change it from 10 to 30 so to leave it at 10?
It may be a problem with the "real server"... can you open a browser on that server and open the URL [ http://www.catswhoblog.com ]? It works for me from my remote server, works for you when running at "a local host", so that seems to point to the one machine (the "real server" you mentioned).
If you can't open a browser on that server, then I'll need a bit more information:
1.) what operating system (Windows, Linux, etc)
2.) what kind of environment (graphical or command line)?
3.) give us a name for the "real server" so we don't have to keep writing "real server" :)
If you can't open a browser on that server, then I'll need a bit more information:
1.) what operating system (Windows, Linux, etc)
2.) what kind of environment (graphical or command line)?
3.) give us a name for the "real server" so we don't have to keep writing "real server" :)
Sorry about that; leave the value at 30.
ASKER
Its rack space server linux command line (and ftp). The think is that its Ive been testing it for the past few days sometimes its work ok and sometimes its give false for the best 20 hours its been giving a lot of falsh alarm( I set it as a cron job to run every 5 min) so it email and the website is still up.
Im actully checking it on http://www.completelocksmith.com/ with "Our mission is"
maybe I can open a browser from the serevr but im not really sure how what is the command for that?
Im actully checking it on http://www.completelocksmith.com/ with "Our mission is"
maybe I can open a browser from the serevr but im not really sure how what is the command for that?
ASKER
and now I noticed that when Im runing it from the command line the results keep changing for exmple : now I ran the script (php -f path) and its alert as the site is down but also its seem thats its return false from fscopen . look at the code I added a test point.
if (!$fp) {
echo "nurit.$errstr ($errno)\n"
ASKER
Ok another information I have two script that I'm testing one of them from my home directory and the other one from a root of another website I have on the server. only in one of them its seem that getting into
the if (!$fp) {
echo "nurit.$errstr ($errno)\n"
(fscopen is false)
also another option I just thought is that the hosting server ( http://www.completelocksmith.com/ )
is blocked my request from rackspace. do you think its possible?
the if (!$fp) {
echo "nurit.$errstr ($errno)\n"
(fscopen is false)
also another option I just thought is that the hosting server ( http://www.completelocksmith.com/ )
is blocked my request from rackspace. do you think its possible?
ASKER
Ok im so sorry ignore all the notes for the if (!$fp) {
echo "nurit.$errstr ($errno)\n"
(fscopen is false)
Its not getting into the if I got comp-used with a diffrent testing code I did. beside that everything is as I wrote.
echo "nurit.$errstr ($errno)\n"
(fscopen is false)
Its not getting into the if I got comp-used with a diffrent testing code I did. beside that everything is as I wrote.
PHP on the command line isn't the same as what is used on the web. You can write a script that just has this line; you can test it both on the command line and from the web.
As for the website in question, [ http://www.catswhoblog.com ]: it seems to have a couple of different problems that should be checked out. As you can see in the attached image, there are a couple of things that can't be found and severely affect the load time, such as:
* http://www.catswhoblog.com/wp-content/themes/cwb3/images/sep-small.gif
* http://www.catswhoblog.com/wp-content/themes/cwb3/fonts/BebasNeue-webfont.woff (two attempts, one was aborted for some reason)
<?php
phpinfo();
As for the website in question, [ http://www.catswhoblog.com ]: it seems to have a couple of different problems that should be checked out. As you can see in the attached image, there are a couple of things that can't be found and severely affect the load time, such as:
* http://www.catswhoblog.com/wp-content/themes/cwb3/images/sep-small.gif
* http://www.catswhoblog.com/wp-content/themes/cwb3/fonts/BebasNeue-webfont.woff (two attempts, one was aborted for some reason)
ASKER
this is not the website Im checking it was just an exmple this is the website:http://www.completelocksmith.com/
I need more information, as stated earlier, before we proceed. You can try using my current code, which clears up some rather strange logic from yours:
You can see the result at [ http://test.crazedsanity.com/EE/Q_27212881.php ] (I've made a few extra modifications to make it easier to find and look at).
The part of your code that struck me funny was around line 15:
<?php
echo "<html><title>Test Script: Why does the php monitoring website return false alarm</title>";
function check($host, $find) {
$result = 0;
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)\n";
} else {
$header = "GET / HTTP/1.1\r\n";
$header .= "Host: $host\r\n";
$header .= "Connection: close\r\n\r\n";
fputs($fp, $header);
while (!feof($fp)) {
$str .= fgets($fp, 1024);
}
fclose($fp);
if(strpos($str, $find))
{
$result = 1;
}
}
return ($result);
}
function alert($host) {
//mail('youremail@gmail.com', 'Monitoring', $host.' down');
}
$host = 'www.completelocksmith.com';
$find = 'Our mission';
$startTime = microtime(true);
$checkResult = check($host, $find);
$totalTime = number_format((microtime(true) - $startTime),6);
echo "HOST: ". $host ."<BR>";
echo "STRING: '". $find ."'<BR>";
echo "RESULT OF CHECK: (". $checkResult ."), totalTime=(". $totalTime .")";
if (!$checkResult){
alert($host);
}
You can see the result at [ http://test.crazedsanity.com/EE/Q_27212881.php ] (I've made a few extra modifications to make it easier to find and look at).
The part of your code that struck me funny was around line 15:
return (strpos($str, $find) !== false);
The logic is really... non-obvious. "Does $find exist in $str? Does what you just returned say false, because if it did, you should say true." Or something like that... in my updated code, I've over-simplified that logic, because I hate using "negative logic". Just like using double-negatives in English, using negative logic makes things confusing and hard to read.
Check the link here:
http://www.laprbass.com/RAY_monitor_website.php
On line 69 of this script you can put your own email communications to alert you of any problems. You can also add some kind of checking for the various ports if you want.
HTH, ~Ray
http://www.laprbass.com/RAY_monitor_website.php
On line 69 of this script you can put your own email communications to alert you of any problems. You can also add some kind of checking for the various ports if you want.
HTH, ~Ray
<?php // RAY_monitor_website.php
error_reporting(E_ALL);
// DEMONSTRATE HOW AN INDIVIDUAL WEB SITE MONITOR WORKS
// A WEB SITE TO MONITOR
$url = 'www.completelocksmith.com';
// COMMONLY USED PORT NUMBERS
// SEE: http://www.iana.org/assignments/port-numbers
// SEE: http://browntips.com/cpanel-and-whm-port-numbers/
$ports["HTTP"] = 80;
$ports["FTP"] = 21;
$ports["SSH"] = 22;
$ports["TELNET"] = 23;
$ports["SMTP"] = 25;
$ports["DNS"] = 53;
$ports["MYSQL"] = 3306;
$ports["CPANEL"] = 2082;
$ports["CPANEL-S"] = 2083;
$ports["WHM"] = 2086;
$ports["WHM-S"] = 2087;
$ports["POP3"] = 110;
$ports["IMAP"] = 143;
$ports["BOGUS"] = 11111; // THIS IS EXPECTED TO FAIL
// THE RESULTS SET
$errno = $errstr = array();
// THE TIME TO ALLOW FOR CONNECTION
$timex = 1;
// TEST EACH OF THE PORTS - SEE http://us.php.net/manual/en/function.fsockopen.php
foreach ($ports as $port_name => $port_number)
{
$fp
= @fsockopen // @MAKE ERRORS SILENT
( $url
, $port_number
, $errno[$port_name]
, $errstr[$port_name]
, $timex
)
;
}
// REPORT WHAT HAPPENED
echo "<pre>";
// echo 'WHO: ' . exec('whoami') . PHP_EOL;
echo "URL: $url TIME: $timex" . PHP_EOL;
foreach ($errno as $port_name => $error_number)
{
if (!$error_number)
{
echo PHP_EOL . "OK: $port_name $ports[$port_name]";
}
else
{
echo PHP_EOL . "ERROR $error_number: $port_name $errstr[$port_name] ON PORT $ports[$port_name]";
}
}
// TEST WWW RESPONSE WITH CURL
$x = my_curl('http://' . $url . '/anything_will_do_here');
if (!$x)
{
echo PHP_EOL . "ERROR WWW Response: FAIL";
}
else
{
echo PHP_EOL . "WWW RESPONSE OK";
}
// A FUNCTION TO RUN A CURL-GET CLIENT CALL TO A FOREIGN SERVER
function my_curl($url, $timeout=4, $error_report=FALSE)
{
$curl = curl_init();
// HEADERS AND OPTIONS APPEAR TO BE A FIREFOX BROWSER REFERRED BY GOOGLE
$header[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: "; // BROWSERS USUALLY LEAVE BLANK
// SET THE CURL OPTIONS - SEE http://php.net/manual/en/function.curl-setopt.php
curl_setopt( $curl, CURLOPT_URL, $url );
curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6' );
curl_setopt( $curl, CURLOPT_HTTPHEADER, $header );
curl_setopt( $curl, CURLOPT_REFERER, 'http://www.google.com' );
curl_setopt( $curl, CURLOPT_ENCODING, 'gzip,deflate' );
curl_setopt( $curl, CURLOPT_AUTOREFERER, TRUE );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE );
curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, TRUE );
curl_setopt( $curl, CURLOPT_TIMEOUT, $timeout );
// RUN THE CURL REQUEST AND GET THE RESULTS
$htm = curl_exec($curl);
// ON FAILURE HANDLE ERROR MESSAGE
if ($htm === FALSE)
{
if ($error_report)
{
$err = curl_errno($curl);
$inf = curl_getinfo($curl);
echo "CURL FAIL: $url TIMEOUT=$timeout, CURL_ERRNO=$err";
var_dump($inf);
}
curl_close($curl);
return FALSE;
}
// ON SUCCESS RETURN XML / HTML STRING
curl_close($curl);
return $htm;
}
ASKER
Hi
I wrote more info :
What other info do you need?
-------------------------- ---
Its rack space server linux command line (and ftp). The think is that its Ive been testing it for the past few days sometimes its work ok and sometimes its give false for the best 20 hours its been giving a lot of falsh alarm( I set it as a cron job to run every 5 min) so it email and the website is still up.
Im actully checking it on http://www.completelocksmith.com/ with "Our mission is"
maybe I can open a browser from the serevr but im not really sure how what is the command for that?
---------------
Also: the results for the next code:
at my local host:
RESULT OF CHECK: (1), totalTime=(1.617994)
and at rackspace:
RESULT OF CHECK: (), totalTime=(0.578190)
I wrote more info :
What other info do you need?
--------------------------
Its rack space server linux command line (and ftp). The think is that its Ive been testing it for the past few days sometimes its work ok and sometimes its give false for the best 20 hours its been giving a lot of falsh alarm( I set it as a cron job to run every 5 min) so it email and the website is still up.
Im actully checking it on http://www.completelocksmith.com/ with "Our mission is"
maybe I can open a browser from the serevr but im not really sure how what is the command for that?
---------------
Also: the results for the next code:
at my local host:
RESULT OF CHECK: (1), totalTime=(1.617994)
and at rackspace:
RESULT OF CHECK: (), totalTime=(0.578190)
$startTime = microtime(true);
$checkResult = check($host, $find);
$totalTime = number_format((microtime(true) - $startTime),6);
echo "RESULT OF CHECK: (". $checkResult ."), totalTime=(". $totalTime .")";
Well, I guess I need more information about the server at rackspace (assumedly this is some server at rackspace.com). It sounds like you're running it from the command line, so we need version info. This should do the trick:
It is possible that the rackspace server can't connect to www.completelocksmith.com's port 80. Try running the script from Ray_Paseur, see what that comes up with. This is sounding like either a PHP issue or a networking one.
php --info > file.txt
(upload file.txt so I can see it)It is possible that the rackspace server can't connect to www.completelocksmith.com's port 80. Try running the script from Ray_Paseur, see what that comes up with. This is sounding like either a PHP issue or a networking one.
When I run http://www.laprbass.com/RAY_monitor_website.php I get this result.
URL: www.completelocksmith.com TIME: 1
OK: HTTP 80
OK: FTP 21
ERROR 110: SSH Connection timed out ON PORT 22
ERROR 111: TELNET Connection refused ON PORT 23
OK: SMTP 25
OK: DNS 53
OK: MYSQL 3306
OK: CPANEL 2082
OK: CPANEL-S 2083
OK: WHM 2086
OK: WHM-S 2087
OK: POP3 110
OK: IMAP 143
ERROR 111: BOGUS Connection refused ON PORT 11111
WWW RESPONSE OK
URL: www.completelocksmith.com TIME: 1
OK: HTTP 80
OK: FTP 21
ERROR 110: SSH Connection timed out ON PORT 22
ERROR 111: TELNET Connection refused ON PORT 23
OK: SMTP 25
OK: DNS 53
OK: MYSQL 3306
OK: CPANEL 2082
OK: CPANEL-S 2083
OK: WHM 2086
OK: WHM-S 2087
OK: POP3 110
OK: IMAP 143
ERROR 111: BOGUS Connection refused ON PORT 11111
WWW RESPONSE OK
Interestingly, I get these results:
http://test.crazedsanity.com/EE/RAY_monitor_website.php
URL: www.completelocksmith.com TIME: 1
OK: HTTP 80
OK: FTP 21
OK: SSH 22
OK: TELNET 23
OK: SMTP 25
OK: DNS 53
OK: MYSQL 3306
OK: CPANEL 2082
OK: CPANEL-S 2083
OK: WHM 2086
OK: WHM-S 2087
OK: POP3 110
OK: IMAP 143
OK: BOGUS 11111
ERROR WWW Response: FAIL
http://test.crazedsanity.com/EE/RAY_monitor_website.php
I think the locksmith likes you better :-)
I changed line 60:
And got this:
$x = my_curl('http://' . $url . '/complete-locksmith-faq.html', 30);
And got this:
URL: www.completelocksmith.com TIME: 1
OK: HTTP 80
OK: FTP 21
ERROR 110: SSH Connection timed out ON PORT 22
ERROR 111: TELNET Connection refused ON PORT 23
ERROR 111: SMTP Connection refused ON PORT 25
OK: DNS 53
OK: MYSQL 3306
OK: CPANEL 2082
OK: CPANEL-S 2083
OK: WHM 2086
OK: WHM-S 2087
OK: POP3 110
OK: IMAP 143
ERROR 111: BOGUS Connection refused ON PORT 11111
WWW RESPONSE OK
Ray - I think the locksmith is finicky. ;)
Disregarding ports 22, 23, and 25 (which aren't important to the question anyway), I get this:
I made a couple of small modifications to show the URL, and I increased the timeout (in the call to "my_curl()" from the default 4 to 30).
Anyway, it seems the rackspace server is having issues. Is it on the same network as the website we're checking? You may just have to call the people that host your rackspace server (rackspace.com?).
Disregarding ports 22, 23, and 25 (which aren't important to the question anyway), I get this:
URL: www.completelocksmith.com TIME: 1
OK: HTTP 80
OK: FTP 21
OK: DNS 53
OK: MYSQL 3306
OK: CPANEL 2082
OK: CPANEL-S 2083
OK: WHM 2086
OK: WHM-S 2087
OK: POP3 110
OK: IMAP 143
ERROR 111: BOGUS Connection refused ON PORT 11111
WWW RESPONSE OK - http://www.completelocksmith.com/complete-locksmith-faq.html
I made a couple of small modifications to show the URL, and I increased the timeout (in the call to "my_curl()" from the default 4 to 30).
Anyway, it seems the rackspace server is having issues. Is it on the same network as the website we're checking? You may just have to call the people that host your rackspace server (rackspace.com?).
That would seem to suggest that the site is up. But it is not definitive, and if you want a more definitive test, you really need to have some data on the server that you can check. Here is why:
The my_curl() function returned something to $x and the next instruction tested to see if $x was FALSE or one of the loosely typed variants of FALSE like zero or NULL or empty. If my_curl() tried to read the foreign site and got a message that said, "SITE DOWN" it would still think everything is OK. In other words, any non-failure response, including a 404 not found is satisfactory for my_curl().
A script you might want to put on the locksmith site might look like this:
<?php echo date('c');
Then you could test the response and see if it looks like a DATETIME string. If it does, your server is probably working OK.
HTH, Over and out, ~Ray
The my_curl() function returned something to $x and the next instruction tested to see if $x was FALSE or one of the loosely typed variants of FALSE like zero or NULL or empty. If my_curl() tried to read the foreign site and got a message that said, "SITE DOWN" it would still think everything is OK. In other words, any non-failure response, including a 404 not found is satisfactory for my_curl().
A script you might want to put on the locksmith site might look like this:
<?php echo date('c');
Then you could test the response and see if it looks like a DATETIME string. If it does, your server is probably working OK.
HTH, Over and out, ~Ray
ASKER
Ok I think i got a little bit lost In your conversation... :) I uploaded the info from the php info()
Thank you both for the help! info.txt
Thank you both for the help! info.txt
There could be a very large number of factors involved. The PHP info you attached didn't help a lot, though it does show you're running a current version of PHP. So... we have to eliminate PHP as the source of the problem (or not).
Run this command and post the resulting "EE_wget.txt" file.
Copy the terminal output as well, it might be helpful. It should look like this:
Run this command and post the resulting "EE_wget.txt" file.
wget http://www.completelocksmith.com -O EE_wget.txt
Copy the terminal output as well, it might be helpful. It should look like this:
user@lenny:~$ wget http://www.completelocksmith.com -O EE_wget.txt
--2011-07-21 16:07:16-- http://www.completelocksmith.com/
Resolving www.completelocksmith.com... 69.41.236.53
Connecting to www.completelocksmith.com|69.41.236.53|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `EE_wget.txt'
[ <=> ] 22,951 --.-K/s in 0.1s
2011-07-21 16:07:18 (222 KB/s) - `EE_wget.txt' saved [22951]
user@lenny:~$
ASKER
Ok just wanted to make sure you saw the previous note:
Also: the results for the next code:
at my local host:
RESULT OF CHECK: (1), totalTime=(1.617994)
and at rackspace:
RESULT OF CHECK: (), totalTime=(0.578190)
and let you know that rack space saying that they are not blocking this connection.
just to sumerrize the problem is that after the cron job is runing for a while with thew script you probably know by heart..:) than from some reason its can get a connection as I mentioned above RESULT OF CHECK: ()
than if I stop the cron job for a while it will be working again (meaning results:RESULT OF CHECK: (1))
Also: the results for the next code:
at my local host:
RESULT OF CHECK: (1), totalTime=(1.617994)
and at rackspace:
RESULT OF CHECK: (), totalTime=(0.578190)
and let you know that rack space saying that they are not blocking this connection.
just to sumerrize the problem is that after the cron job is runing for a while with thew script you probably know by heart..:) than from some reason its can get a connection as I mentioned above RESULT OF CHECK: ()
than if I stop the cron job for a while it will be working again (meaning results:RESULT OF CHECK: (1))
ASKER
so again now the connection is ok even when im runing the script
the results:
2011-07-21 14:35:17-- http://www.completelocksmith.com/
Resolving www.completelocksmith.com... 69.41.236.53
Connecting to www.completelocksmith.com|69.41.236.53|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `EE_wget.txt'
[ <=> ] 22,959 --.-K/s in 0.05s
2011-07-21 14:35:19 (433 KB/s) - `EE_wget.txt' saved [22959]
EE-wget.txt
the results:
2011-07-21 14:35:17-- http://www.completelocksmith.com/
Resolving www.completelocksmith.com... 69.41.236.53
Connecting to www.completelocksmith.com|69.41.236.53|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `EE_wget.txt'
[ <=> ] 22,959 --.-K/s in 0.05s
2011-07-21 14:35:19 (433 KB/s) - `EE_wget.txt' saved [22959]
EE-wget.txt
ASKER
I set the cron job back now and im checking to see when its files to see when its fails again than ill check the connection again
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
(I apparently took took too long to post, so I didn't see those last two comments until later. Previous comment is still valid.)
ASKER
ok A. did you mean to store the results from
echo "HOST: ". $host ."<BR>";
echo "STRING: '". $find ."'<BR>";
echo "RESULT OF CHECK: (". $checkResult ."), totalTime=(". $totalTime .")";
where is it orignally stored those lines in a cron job? and how do I redirect them?
echo "HOST: ". $host ."<BR>";
echo "STRING: '". $find ."'<BR>";
echo "RESULT OF CHECK: (". $checkResult ."), totalTime=(". $totalTime .")";
where is it orignally stored those lines in a cron job? and how do I redirect them?
ASKER
Ok so its current ly not working RESULT OF CHECK: (0) .
again I ran the command wget ---
the results
--2011-07-22 09:36:37-- http://www.completelocksmith.com/
Resolving www.completelocksmith.com... 64.30.224.112
Connecting to www.completelocksmith.com|64.30.224.112|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2011-07-22 09:36:37 ERROR 404: Not Found.
And the EE_wget.txt file is empty let me know if There is any other details I can gice while the script is failing im going to keep running it until you will answer ... hope its will be fast :)
again I ran the command wget ---
the results
--2011-07-22 09:36:37-- http://www.completelocksmith.com/
Resolving www.completelocksmith.com... 64.30.224.112
Connecting to www.completelocksmith.com|64.30.224.112|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2011-07-22 09:36:37 ERROR 404: Not Found.
And the EE_wget.txt file is empty let me know if There is any other details I can gice while the script is failing im going to keep running it until you will answer ... hope its will be fast :)
ASKER
this is the problem: PHP Warning: file_get_contents(http://www.completelocksmith.com/): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
help!!!
help!!!
ASKER
Ok nobody answered but thought to say for the recored its appear to be a DNS issue.
Sorry for the delay in response; I've been under the weather for a few days. Has the issue cleared-up, then?
ASKER
Yes its currentlly working after solving the DNS issues
ASKER
Its wasn't a solution but in defiantly helped in troubleshooting the problem.
Otherwise you could just use something like this:
Open in new window