// @TODO Add some DNS caching here
// Open connection
- if ($helperInstance->isProxyUsed() === TRUE) {
+ if ($helperInstance->isProxyUsed() === true) {
// Resolve hostname into IP address
- $ip = $helperInstance->resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host'));
+ $ip = ConsoleTools::resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host'));
+
+ // @TODO Handle $ip = false
// Connect to host through proxy connection
$socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
} // END - if
// Prepare the GET request
- $request = 'GET ' . ($helperInstance->isProxyUsed() === TRUE ? 'http://shipsimu.org' : '') . '/ip.php HTTP/1.0' . self::HTTP_EOL;
+ $request = 'GET ' . ($helperInstance->isProxyUsed() === true ? 'http://shipsimu.org' : '') . '/ip.php HTTP/1.0' . self::HTTP_EOL;
$request .= 'Host: shipsimu.org' . self::HTTP_EOL;
$request .= 'User-Agent: ' . $this->getUserAgent() . self::HTTP_EOL;
$request .= 'Connection: close' . self::HTTP_EOL;
// Do we use proxy?
- if ($helperInstance->isProxyUsed() === TRUE) {
+ if ($helperInstance->isProxyUsed() === true) {
// CONNECT method?
if ($helperInstance->getConfigInstance()->getConfigEntry('proxy_connect_method') == 'Y') {
// Setup proxy tunnel
// If the response is invalid, abort
if ((count($response) == 3) && (empty($response[0])) && (empty($response[1])) && (empty($response[2]))) {
// Invalid response!
- $helperInstance->debugBackTrace('Proxy tunnel not working: response=' . print_r($response, TRUE));
+ $helperInstance->debugBackTrace('Proxy tunnel not working: response=' . print_r($response, true));
} // END - if
} else {
// Add header for proxy