CURL Error : 407 Proxy Authentication Required
Curl is a module used in Php and several applications require it to meet th...
The only line i missed was to set authentication as NTLM


curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);




Hope th...
Upcoming SlideShare
Loading in …5
×

Curl error 407 proxy authentication required

4,210 views
3,916 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,210
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Curl error 407 proxy authentication required

  1. 1. CURL Error : 407 Proxy Authentication Required Curl is a module used in Php and several applications require it to meet the development needs. This happened one day when one of developers came up and said, hey Curl is giving the following error below Technical Information (for support personnel) * Error Code: 407 Proxy Authentication Required. Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. (12209) * IP Address: 10.10.1.20 * Date: 8/10/2010 9:28:56 AM [GMT] * Server: proxyserver.yourdomain.com * Source: proxy going through several options and forums i was quite exhaused as forums were reporting this issue that when Threat Management Gateway (TMG) or ISA server is running in the network, the applications running curl behind the firewall cannot pass through but didnt provided how to fix it. I did every other settings possible in my firewall to allow it but no luck. The following was the solution that worked $f=fopen("error.txt","w"); $ch = curl_init("http://www.google.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); // follow redirects recursively curl_setopt($ch, CURLOPT_STDERR, $f); curl_setopt($ch, CURLOPT_PROXY, “http://proxyserver:8080″); curl_setopt($ch, CURLOPT_PROXYPORT, 8080); curl_setopt ($ch, CURLOPT_PROXYUSERPWD, “yourdomain.comusername:password”); $x = curl_exec($ch); //print “page:” .$x . curl_error($ch) ; $info = curl_getinfo($ch); print “ ";print_r($info); curl_close($ch); ?>
  2. 2. The only line i missed was to set authentication as NTLM curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM); Hope this helps someone facing this issue!

×