Hi,
Has anyone been successful to get the Module admin working through a proxy with authentication?
I’m using FreePBX 2.9.0.1.
I tried to include export http_proxy + ftp_proxy in the exec("wget…), replace the wget for a script that did the same. I used the following function that works in another setup (to pull rss feeds) combined with what a user provided on this forum (except this did not included authentication):
[php]
function proxy_url($proxy_url) {
$proxy_name = "host";
$proxy_port = port;
$proxy_user = "user"
$proxy_pass = "pass"
$proxy_cont = "";
$proxy_fp = fsockopen($proxy_name, $proxy_port, $errno, $errstr, 2);
if (!$proxy_fp) {return false;}
fputs($proxy_fp, "GET $proxy_url HTTP/1.1\\r\\n");
fputs($proxy_fp, "Proxy-Authorization: Basic ". base64_encode ("$proxy_user:$proxy_pass")."\\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;
}
[/php]
No results… always get a time-out
2011-Sep-16 05:10:47 /var/www/html/admin/libraries/utility.functions.php:417
[WARNING]: file_get_contents(http://mirror.freepbx.org/modules-2.9.xml): failed to open stream: Connection refused
Of course manually test from the prompt it works.
Any suggestions?