$url = constant('SERVER_URL');
// Is this URL valid?
- if (substr($script, 0, 7) == "http://") {
+ if (substr($script, 0, 7) == 'http://') {
// Use the hostname from script URL as new hostname
$url = substr($script, 7);
$extract = explode('/', $url);
} // END - if
// Extract host name
- $host = str_replace("http://", '', $url);
+ $host = str_replace('http://', '', $url);
if (ereg('/', $host)) $host = substr($host, 0, strpos($host, '/'));
// Generate relative URL
//* DEBUG: */ print("SCRIPT=".$script."<br />\n");
- if (substr(strtolower($script), 0, 7) == "http://") {
+ if (substr(strtolower($script), 0, 7) == 'http://') {
// But only if http:// is in front!
$script = substr($script, (strlen($url) + 7));
} elseif (substr(strtolower($script), 0, 8) == "https://") {
// Open connection
//* DEBUG: */ die("SCRIPT=".$script."<br />\n");
- if ($useProxy) {
- $fp = @fsockopen(COMPILE_CODE(getConfig('proxy_host')), getConfig('proxy_port'), $errno, $errdesc, 30);
+ if ($useProxy === true) {
+ // Connect to host through proxy connection
+ $fp = @fsockopen(COMPILE_CODE(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
} else {
+ // Connect to host directly
$fp = @fsockopen($host, 80, $errno, $errdesc, 30);
}
} // END - if
// Do we use proxy?
- if ($useProxy) {
+ if ($useProxy === true) {
// Generate CONNECT request header
$proxyTunnel = "CONNECT " . $host . ":80 HTTP/1.1" . getConfig('HTTP_EOL');
$proxyTunnel .= "Host: " . $host . getConfig('HTTP_EOL');
// Use login data to proxy? (username at least!)
if (getConfig('proxy_username') != '') {
// Add it as well
- $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).getConfig('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password')));
+ $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')) . getConfig('ENCRYPT_SEPERATOR') . COMPILE_CODE(getConfig('proxy_password')));
$proxyTunnel .= "Proxy-Authorization: Basic " . $encodedAuth . getConfig('HTTP_EOL');
} // END - if
//* DEBUG: */ print("<strong>Response:</strong><pre>".print_r($response, true)."</pre>");
// Proxy agent found?
- if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy)) {
+ if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy === true)) {
// Proxy header detected, so remove two lines
array_shift($response);
array_shift($response);