7

Using PHP 5.2.6 and need to configure it to use our forward proxy (which requires authentication be set) so that the PHP scripts can connect to the internet correctly.

I see that PHP.INI in the 4 version had a pfpro.proxyaddress option but that is no longer available - so what has replaced it?

Robert MacLean
  • 2,186
  • 6
  • 28
  • 45

1 Answers1

4

you can use curl for handling your http retrievals.

$ch = curl_init("http://whatever.com/something/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, "http://10.14.10.1:3128");
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, "user:pass"); 

more info here

pQd
  • 29,981
  • 6
  • 66
  • 109
  • 1
    CURLOPT_PROXY with ip:port and a separate CURLOPT_PROXYPORT with the same port sounds unneccesary – Karsten May 25 '09 at 09:45
  • @Karsten - yes. you're right. – pQd May 25 '09 at 11:34
  • -1: That is code related - I am looking for a configuration related method as in v4 that can be set so all requests are proxied. – Robert MacLean May 25 '09 at 14:34
  • @Robert MacLean - it seems what you ask for might be still not implemented - take a look at http://bugs.php.net/bug.php?id=29280 ; they also discuss kind-of-workaround with auto-append and changing settings of default context, but it's a hack – pQd May 25 '09 at 18:24