Issue
Is it possible to apply a proxy configuration to all curl requests (including Symphony HttpBrowser and Guzzle)? If such a possibility exists, how can this be done?
I tried to register an alias for curl in Centos 7
/etc/profile.d/alias.sh:
alias curl="curl --proxy https://xxx.xxx.xxx.xxx:xxxx "
It only works if I run curl from the console, it doesn’t work for PHP curl
Solution
cURL will honor the environment variables http_proxy
, https_proxy
and ALL_PROXY
as the default proxy, so you can set them from the shell (Note: This will affect all curl/wget/etc. commands, Check this answer: https://superuser.com/a/1690537/995824):
export https_proxy=https://your-proxy-url
Or set them in php:
putenv('https_proxy=https://your-proxy-url');
Answered By - shingo Answer Checked By - Willingham (WPSolving Volunteer)