diff --git a/src/ASP/system/functions.php b/src/ASP/system/functions.php index f2459158..38e9fdb7 100644 --- a/src/ASP/system/functions.php +++ b/src/ASP/system/functions.php @@ -417,6 +417,7 @@ function getPageContents($url) { // Try file() first $results = null; + $err = ''; if( function_exists('file') && function_exists('fopen') && ini_get('allow_url_fopen') ) { ini_set("user_agent", "GameSpyHTTP/1.0"); @@ -434,14 +435,17 @@ function getPageContents($url) curl_setopt($curl_handle, CURLOPT_TIMEOUT, 10); $results = curl_exec($curl_handle); $err = curl_error($curl_handle); - if( $err != '' ) - return false; + if( $err != '' ) { + return array($results, $err); + } $results = explode("\n",trim($results)); curl_close($curl_handle); } // still nothing, forgetd a'bout it - if( !$results ) return false; - return $results; + if( !$results ) { + return array($results, "None of these functions exist: file, fopen, allow_url_fopen, curl_exec"); + }; + return array($results, $err); } ?> diff --git a/src/ASP/system/modules/Testconfig.php b/src/ASP/system/modules/Testconfig.php index 4b1a8b36..88adc7bb 100644 --- a/src/ASP/system/modules/Testconfig.php +++ b/src/ASP/system/modules/Testconfig.php @@ -221,80 +221,82 @@ public function ProcessTest() $out .= " > Checking BF2Statistics Processing...
"; // Post the headers and snapshot data + $url = "http://{$_SERVER['HTTP_HOST']}/ASP/bf2statistics.php"; $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, "http://{$_SERVER['HTTP_HOST']}/ASP/bf2statistics.php"); + curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $tst_snapshot); curl_setopt($ch, CURLOPT_USERAGENT, "GameSpyHTTP/1.0"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 5); $result = curl_exec($ch); + $err = curl_error($ch); $curlInfo = curl_getinfo($ch); curl_close($ch); if ($result && $curlInfo['http_code'] == 200) { - $out .= "     - BF2Statistics Processing Check: ".__PASS; + $out .= "     - BF2Statistics Processing Check (URL: $url): ".__PASS; } else { - $out .= "     - BF2Statistics Processing Check: ".__FAIL; + $out .= "     - BF2Statistics Processing Check (URL: $url): Error: $err. ".__FAIL; $errors = true; } // Check .aspx Page Responses $out .= " > Checking Gamespy (.aspx) File Basic Response...
"; $url = "http://".$_SERVER['HTTP_HOST']."/ASP/getbackendinfo.aspx"; - $response = getPageContents($url); + list($response, $err) = getPageContents($url); if ($response === false || trim($response[0]) != 'O') { - $out .= "     - Gamespy (.aspx) Basic Response: ".__FAIL; + $out .= "     - Gamespy (.aspx) Basic Response (URL: $url): Error: $err. ".__FAIL; $errors = true; } else { - $out .= "     - Gamespy (.aspx) Basic Response: ".__PASS; + $out .= "     - Gamespy (.aspx) Basic Response (URL: $url): ".__PASS; } // Advanced request (1) $out .= " > Checking Gamespy (.aspx) File Advanced Responses...
"; $url = "http://".$_SERVER['HTTP_HOST']."/ASP/getawardsinfo.aspx?pid=". $tst_pid; - $response = getPageContents($url); + list($response, $err) = getPageContents($url); if ($response === false || trim($response[0]) != 'O') { - $out .= "     - Gamespy (.aspx) Advanced (1) Response: ".__FAIL; + $out .= "     - Gamespy (.aspx) Advanced (1) Response (URL: $url): Error: $err. ".__FAIL; $errors = true; } else { - $out .= "     - Gamespy (.aspx) Advanced (1) Response: ".__PASS; + $out .= "     - Gamespy (.aspx) Advanced (1) Response (URL: $url): ".__PASS; } // Advanced Request (2) $url = "http://".$_SERVER['HTTP_HOST']."/ASP/getrankinfo.aspx?pid=". $tst_pid; - $response = getPageContents($url); + list($response, $err) = getPageContents($url); if ($response === false || trim($response[0]) != 'O') { - $out .= "     - Gamespy (.aspx) Advanced (2) Response: ".__FAIL; + $out .= "     - Gamespy (.aspx) Advanced (2) Response (URL: $url): Error: $err. ".__FAIL; $errors = true; } else { - $out .= "     - Gamespy (.aspx) Advanced (2) Response: ".__PASS; + $out .= "     - Gamespy (.aspx) Advanced (2) Response (URL: $url): ".__PASS; } // Advanced Request (3) $url = "http://".$_SERVER['HTTP_HOST']."/ASP/getunlocksinfo.aspx?pid=". $tst_pid; - $response = getPageContents($url); + list($response, $err) = getPageContents($url); if ($response === false || trim($response[0]) != 'O') { - $out .= "     - Gamespy (.aspx) Advanced (3) Response: ".__FAIL; + $out .= "     - Gamespy (.aspx) Advanced (3) Response (URL: $url): Error: $err. ".__FAIL; $errors = true; } else { - $out .= "     - Gamespy (.aspx) Advanced (3) Response: ".__PASS; + $out .= "     - Gamespy (.aspx) Advanced (3) Response (URL: $url): ".__PASS; } }