98e50d0152612f4a2996fb085b8a6526d44fc2e7
[core.git] / framework / main / classes / client / http / class_HttpClient.p
1
2                 // First get a socket
3                 // @TODO Add some DNS caching here
4
5                 // Open connection
6                 if ($helperInstance->isProxyUsed() === true) {
7                         // Resolve hostname into IP address
8                         $ip = ConsoleTools::resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host'));
9
10                         // @TODO Handle $ip = false
11
12                         // Connect to host through proxy connection
13                         $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
14                 } else {
15                         // Connect to host directly
16                         $socketResource = fsockopen('188.138.90.169', 80, $errorNo, $errorStr, 30);
17                 }
18
19                 // Check if there was an error else
20                 if ($errorNo > 0) {
21                         // Then throw again
22                         throw new InvalidSocketException(array($helperInstance, $socketResource, $errorNo, $errorStr), BaseListener::EXCEPTION_INVALID_SOCKET);
23                 } // END - if