dingus Posted May 8, 2008 Share Posted May 8, 2008 hey im developing a peace of software for a school that needs to interface from the internetal network to there external network via a proxy server is there a way that i can force all out going socket connections from php to be roughed via this proxy with out having to define it on a system level? Link to comment https://forums.phpfreaks.com/topic/104658-force-fsockopen-to-use-proxy/ Share on other sites More sharing options...
dingus Posted May 8, 2008 Author Share Posted May 8, 2008 can no one help with this? Link to comment https://forums.phpfreaks.com/topic/104658-force-fsockopen-to-use-proxy/#findComment-535839 Share on other sites More sharing options...
947740 Posted May 8, 2008 Share Posted May 8, 2008 Maybe you should try making your question a bit more clear. Link to comment https://forums.phpfreaks.com/topic/104658-force-fsockopen-to-use-proxy/#findComment-536009 Share on other sites More sharing options...
discomatt Posted May 8, 2008 Share Posted May 8, 2008 Why not just connect to the proxy using fsockopen and route all further connections through that? <?php function proxy_url($proxy_url) { $proxy_name = '127.0.0.1'; $proxy_port = 4001; $proxy_user = "user"; // added $proxy_pass = "password"; // added $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"); fputs($proxy_fp, "Proxy-Authorization: Basic " . base64_encode ("$proxy_user:$proxy_pass") . "\r\n\r\n"); // added 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; } ?> Link to comment https://forums.phpfreaks.com/topic/104658-force-fsockopen-to-use-proxy/#findComment-536015 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.