]> git.mxchange.org Git - core.git/blobdiff - inc/main/classes/client/http/class_HttpClient.p
Renamed classes/main/ to main/classes/ + added FuseFeature, an upcoming feature
[core.git] / inc / main / classes / client / http / class_HttpClient.p
diff --git a/inc/main/classes/client/http/class_HttpClient.p b/inc/main/classes/client/http/class_HttpClient.p
new file mode 100644 (file)
index 0000000..c8222de
--- /dev/null
@@ -0,0 +1,21 @@
+
+               // 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