All of my external connections needs to go through a proxy, so for my user I've added this line to allow me to wget
or yum
freely
~/.bashrc
export http_proxy=http://10.50.24.125:8080/
The part above works great, but for a PHP script I have, I'm trying to use php_curl
to fetch a file, so I'm defining the same proxy there too:
$curlHandle=curl_init();
curl_setopt($curlHandle, CURLOPT_URL, 'http://www.google.com');
curl_setopt($curlHandle, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($curlHandle, CURLOPT_PROXYPORT, 8080);
curl_setopt($curlHandle, CURLOPT_PROXY, '10.50.24.125');
$out=curl_exec($curlHandle);
echo $out;
curl_close($curlHandle);
However, I don't see any results, and for some strange reason when I netstat -n
while running the script, I can see the connection the script is trying to make, which is the strange part:
tcp 0 0 10.50.25.83:80 10.20.5.15:51194 TIME_WAIT
So instead of connecting to 10.50.24.125:8080 it's connecting to 10.20.5.15 on a random port, and the source port on local is 80?
Any ideas?
Note: running CentOS 5.6