]> git.mxchange.org Git - core.git/blob - inc/classes/main/client/http/class_HttpClient.p
Opps, forgot this.
[core.git] / inc / classes / main / 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 = $helperInstance->resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host'));
9
10                         // Connect to host through proxy connection
11                         $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
12                 } else {
13                         // Connect to host directly
14                         $socketResource = fsockopen('188.138.90.169', 80, $errorNo, $errorStr, 30);
15                 }
16
17                 // Check if there was an error else
18                 if ($errorNo > 0) {
19                         // Then throw again
20                         throw new InvalidSocketException(array($helperInstance, $socketResource, $errorNo, $errorStr), BaseListener::EXCEPTION_INVALID_SOCKET);
21                 } // END - if