note 47224 deleted from function.fopen by cmb

From: Date: Fri, 09 Sep 2016 22:40:40 +0000
Subject: note 47224 deleted from function.fopen by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206555@lists.php.net to get a copy of this message
Note Submitter: pflaume dot NOSPAM at NOSPAM dot gmx dot de ---- fopen() and PROXY I wondered why there is no possibility to use fopen() through a proxy in php. The solution posted above did not work for me. This little function gets http through a given proxy: <?php function proxy_url($proxy_url) { $proxy_name = '127.0.0.1'; $proxy_port = 4001; $proxy_cont = ''; $proxy_fp = fsockopen($proxy_name, $proxy_port); if (!$proxy_fp) {return false;} fputs($proxy_fp, "GET $proxy_url HTTP/1.0\r\nHost: $proxy_name\r\n\r\n"); while(!feof($proxy_fp)) {$proxy_cont .= fread($proxy_fp,4096);} fclose($proxy_fp); $proxy_cont = substr($proxy_cont, strpos($proxy_cont,"\r\n\r\n")+4); return $proxy_cont; } ?>

« previous php.notes (#206555) next »