Getting through a firewall

From: Date: Mon, 23 Oct 2000 15:59:12 +0000
Subject: Getting through a firewall
Groups: php.general 
Request: Send a blank email to php-general+get-21920@lists.php.net to get a copy of this message
The script below accesses the LocalHost, but I cannot get outside the firewall. With my browsers, no problem. The WinGate firewall does use a client on the workstations and it is set to "FIREWALL" [the name of the server], 192.168.0.1, 2080. What am I missing? Todd +++ This works with either my DSL IP of 209.204.172.137 or with "localhost". But I cannot get outside with "http://www.aristeware.com". <? class http { var $proxy_host = ""; var $proxy_port = 0; /* The proxy server uses IP 192.168.0.1 and port 2080 however, there is a WinGate client running on the workstation */ //var $proxy_host = "192.168.0.1"; //var $proxy_port = 2080; function http_fopen($host, $path, $port = 80) { # has the user set $proxy_host? if(empty($this->proxy_host)) { # we access the server directly $conn_host = $host; $conn_port = $port; } else { # we use the proxy $conn_host = $this->proxy_host; $conn_port = $this->proxy_port; } # build the absolute URL $abs_url = "http://$host:$port$path"; # now we build our query $query = "GET $abs_url HTTP/1.0\r\n". "Host: $host:$port\r\n". "User-agent: PHP/class http 0.1\r\n". "\r\n"; # open a connection to the server $fp = fsockopen($conn_host, $conn_port); # if the connection failed, return false if(!$fp) return false; # send our query fputs($fp, $query); # discard the HTTP header while(trim(fgets($fp, 1024)) != ""); # return the active file pointer return $fp; } } $http = new http; /* I cannot get "outside" */ //$fp = $http->http_fopen("www.aristesoftware.com", "/"); $fp = $http->http_fopen("localhost", "/"); if(!$fp) { print "Sorry, the server is not currently available"; exit; } /* I cannot get "outside" */ //print "<BASE HREF=\"http://www.aristesoftware.com/\"><p>"; print "<BASE HREF=\"http://localhost/\"><p>"; fpassthru($fp); ?> +++ -- Todd Cary Ariste Software todd@aristesoftware.com

« previous php.general (#21920) next »