note 43132 deleted from function.fopen by aidan

From: Date: Tue, 28 Sep 2004 12:15:52 +0000
Subject: note 43132 deleted from function.fopen by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77505@lists.php.net to get a copy of this message
Note Submitter: jemore at m6net.fr ---- Based on a previous code, here is the getThroughProxy function, with proxy Basic authentification : function getthroughproxy ($myfiles, $proxyhost="0.0.0.0", $proxyport=0, $proxyuser = '', $proxypass = '' ) { $errno = ''; $errstr = ''; $datei = fsockopen($proxyhost, $proxyport, &$errno, &$errstr,30); if( !$datei ) { return array('headers'=>false, 'content'=>false, 'errno'=>$errno, 'errstr'=>$errstr); // ^^^ proxy not available } else { fputs($datei,"GET $myfiles HTTP/1.0\n"); if ('' !== $proxyuser) { fputs($datei, 'Proxy-Authorization: Basic '.base64_encode("$proxyuser:$proxypass")."\n"); } fputs($datei, "\n\n"); $zeile = ''; while (!feof($datei)) { $zeile =$zeile.fread($datei,4096); } } fclose($datei); return array('headers'=>substr($zeile,0,strpos($zeile,"\r\n\r\n")), 'content'=>substr($zeile,strpos($zeile,"\r\n\r\n")+4), 'errno'=>$errno, 'errstr'=>$errstr); }

« previous php.notes (#77505) next »