From 43be0fdfac4880bc260f127cc8b1356277acb465 Mon Sep 17 00:00:00 2001 From: Christian Haschek Date: Thu, 1 Oct 2015 15:17:10 +0200 Subject: [PATCH] added debug functin and fixed false negatives of "isURLReachable" method --- http2pic.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/http2pic.class.php b/http2pic.class.php index 7610ba8..54d5f35 100644 --- a/http2pic.class.php +++ b/http2pic.class.php @@ -16,6 +16,9 @@ // Stuff you can edit // +// if true, will save all cmd queries +define(DEBUG,false); + define(MAXTIMEOUT,30); define(ONFAILIMAGE,'https://http2pic.haschek.at/img/failed.jpg'); @@ -157,6 +160,12 @@ class http2pic $this->params['cmd'] = $cmd; $this->postRender(); + if(DEBUG) + { + $fp = fopen('debug.log', 'a'); + fwrite($fp, $cmd."\n"); + fclose($fp); + } return $cmd; } @@ -195,6 +204,13 @@ class http2pic $this->params['cmd'] = $cmd; $this->postRender(); + + if(DEBUG) + { + $fp = fopen('debug.log', 'a'); + fwrite($fp, $cmd."\n"); + fclose($fp); + } return $cmd; } @@ -268,7 +284,7 @@ class http2pic curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if($code == 200) + if($code < 400) //status code updated so redirects will also work $status = true; else $status = false;