[thelist] proxy authorization through PHP?

s t e f notabene at members.evolt.org
Thu Aug 1 05:51:00 CDT 2002


Hi all,

I'm trying to fetch a page outside our intranet, but our proxy requires
that we're logged in to it so that the page can be fetched. Otherwise of
course it returns the error "Proxy authorization required - Username
authentication is required for using this proxy. Either your browser does
not perform proxy authorization, or your authorization has failed." Of
course I have a login/password for myself, but I don't know the correct
syntax for my PHP script to send them to the proxy. I guess it's a
fputs(something_or_other) but I googlized extensively to no avail...

Anybody knows how to send info to a proxy through PHP?

Here's the code so far:
----------
$str = "";
$data = fsockopen("proxy", 8080);
 if( !$data )
  {
      echo "proxy not available !";
     fclose($data);
     exit();
 } else {
	  fputs($data,"GET $url HTTP/1.0\r\n\r\n");
       while (!feof($data))
       {
                 $str .= fgets($data,1000);
       }
	   fclose($data);
 }

echo $str;
-----------

TIA
s t e f





More information about the thelist mailing list