-
-
Save andviro/c1f5e179bc01228f33af55364c361586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "auto_prepend_file=/opt/www/proxy.php" >> /etc/php5/cli/php.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$proxy = getenv('http_proxy'); | |
if (!empty($proxy)) { | |
$proxy = str_replace('http://', 'tcp://', $proxy); | |
echo "Found a proxy " . $proxy . PHP_EOL; | |
$context = array( | |
'http' => array( | |
'proxy' => $proxy, | |
'request_fulluri' => true, | |
'verify_peer' => false, | |
'verify_peer_name' => false, | |
), | |
"ssl"=>array( | |
"verify_peer"=>false, | |
"verify_peer_name"=>false | |
) | |
); | |
stream_context_set_default($context); | |
} else { | |
echo "Proxy not found" . PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment