views:

24

answers:

2

I am trying to do curl requests through my local xampp setup but my company has a firewall proxy that needs to authenticate on port 8080. Can I have apache login to this proxy authenticate and complete the curl requests?

A: 

You can do it in your curl request

if for example you are coding in php

curl_setopt($this->ch, CURLOPT_PROXY, "http://proxy");
curl_setopt($this->ch, CURLOPT_PROXYPORT, 8080);

You will probably need to use CURLOPT_PROXYAUTH as well

or you may want to try setting HTTP_PROXY ENV variable

Shaun Hare
This worked: curl_setopt($ch, CURLOPT_PROXY, "http://proxy");curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password"); curl_setopt($ch, CURLOPT_PROXYPORT, 8080);
Andres
How would I set the HTTP_PROXY ENV? Would this default all PHP outgoing request to use it?
Andres
In a XAMPP installation, you can set the HTTP_PROXY ENV variable in the ./apache/conf/extra/http-xampp.conf file by adding the following line inside an <IfModule env_module> block: SetEnv HTTP_PROXY "http://username:pass@serveraddress:portnumber"
Andres
A: 

To set HTTP_PROXY

export http_proxy=http://proxy:8080/

Shaun Hare
How would I set the username and password? Btw this is a xampp setup on windows. Would I use htaccess? How?
Andres