+
+ // First get a socket
+ // @TODO Add some DNS caching here
+
+ // Open connection
+ if ($helperInstance->isProxyUsed() === TRUE) {
+ // Resolve hostname into IP address
+ $ip = $helperInstance->resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host'));
+
+ // Connect to host through proxy connection
+ $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
+ } else {
+ // Connect to host directly
+ $socketResource = fsockopen('188.138.90.169', 80, $errorNo, $errorStr, 30);
+ }
+
+ // Check if there was an error else
+ if ($errorNo > 0) {
+ // Then throw again
+ throw new InvalidSocketException(array($helperInstance, $socketResource, $errorNo, $errorStr), BaseListener::EXCEPTION_INVALID_SOCKET);
+ } // END - if