+ // Is there a link?
+ if (!is_resource($fp)) {
+ // Failed!
+ return array("", "", "");
+ } // END - if
+
+ // Do we use proxy?
+ if ($useProxy) {
+ // Generate CONNECT request header
+ $request = "CONNECT ".$host.":80 HTTP/1.1\r\n";
+ $request .= "Host: ".$host."\r\n";
+
+ // Use login data to proxy? (username at least!)
+ if (!empty($_CONFIG['proxy_username'])) {
+ // Add it as well
+ $encodedAuth = base64_encode(COMPILE_CODE($_CONFIG['proxy_username']).":".COMPILE_CODE($_CONFIG['proxy_password']));
+ $request .= "Proxy-Authorization: Basic ".$encodedAuth."\r\n";
+ } // END - if
+
+ // Add last new-line
+ $request .= "\r\n";
+ //* DEBUG: */ print("<strong>Request:</strong><pre>".$request."</pre>");
+
+ // Write request
+ fputs($fp, $request);
+
+ // Got response?
+ if (feof($fp)) {
+ // No response received
+ return array("", "", "");
+ } // END - if
+
+ // Read the first line
+ $resp = trim(fgets($fp, 10240));
+ $respArray = explode(" ", $resp);
+ if ((strtolower($respArray[0]) !== "http/1.0") || ($respArray[1] != "200")) {
+ // Invalid response!
+ return array("", "", "");
+ } // END - if
+ } // END - if
+
+ // Generate GET request header
+ $request = "GET /".trim($script)." HTTP/1.1\r\n";