SlideShare une entreprise Scribd logo
1  sur  2
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);

?>
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!

Contenu connexe

Similaire à Curl error 407 proxy authentication required

Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsBen Hall
 
Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10Combell NV
 
Penetration Testing Report
Penetration Testing ReportPenetration Testing Report
Penetration Testing ReportAman Srivastava
 
Taming botnets
Taming botnetsTaming botnets
Taming botnetsf00d
 
Life Cycle And Detection Of Bot Infections Through Network Traffic Analysis
Life Cycle And Detection Of Bot Infections Through Network Traffic AnalysisLife Cycle And Detection Of Bot Infections Through Network Traffic Analysis
Life Cycle And Detection Of Bot Infections Through Network Traffic AnalysisPositive Hack Days
 
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...Zoltan Balazs
 
Making the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsMaking the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsBen Ramsey
 
Secure programming with php
Secure programming with phpSecure programming with php
Secure programming with phpMohmad Feroz
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecuritiesamiable_indian
 
The Internet of Insecure Things: 10 Most Wanted List
The Internet of Insecure Things: 10 Most Wanted ListThe Internet of Insecure Things: 10 Most Wanted List
The Internet of Insecure Things: 10 Most Wanted ListSecurity Weekly
 
Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousFrancis Alexander
 
Security Tips to run Docker in Production
Security Tips to run Docker in ProductionSecurity Tips to run Docker in Production
Security Tips to run Docker in ProductionGianluca Arbezzano
 
FIWARE Wednesday Webinars - How to Debug IoT Agents
FIWARE Wednesday Webinars - How to Debug IoT AgentsFIWARE Wednesday Webinars - How to Debug IoT Agents
FIWARE Wednesday Webinars - How to Debug IoT AgentsFIWARE
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon praguehernanibf
 
Mobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructureMobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructureMichael Palotas
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsShakacon
 
Reversing & malware analysis training part 12 rootkit analysis
Reversing & malware analysis training part 12   rootkit analysisReversing & malware analysis training part 12   rootkit analysis
Reversing & malware analysis training part 12 rootkit analysisAbdulrahman Bassam
 
amrapali builders@@@hacking d link routers with hnap.pdf
amrapali builders@@@hacking d link routers with hnap.pdfamrapali builders@@@hacking d link routers with hnap.pdf
amrapali builders@@@hacking d link routers with hnap.pdfamrapalibuildersreviews
 

Similaire à Curl error 407 proxy authentication required (20)

Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
Kioptrix 2014 5
Kioptrix 2014 5Kioptrix 2014 5
Kioptrix 2014 5
 
Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10
 
Penetration Testing Report
Penetration Testing ReportPenetration Testing Report
Penetration Testing Report
 
Taming botnets
Taming botnetsTaming botnets
Taming botnets
 
Life Cycle And Detection Of Bot Infections Through Network Traffic Analysis
Life Cycle And Detection Of Bot Infections Through Network Traffic AnalysisLife Cycle And Detection Of Bot Infections Through Network Traffic Analysis
Life Cycle And Detection Of Bot Infections Through Network Traffic Analysis
 
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
 
gofortution
gofortutiongofortution
gofortution
 
Making the Most of HTTP In Your Apps
Making the Most of HTTP In Your AppsMaking the Most of HTTP In Your Apps
Making the Most of HTTP In Your Apps
 
Secure programming with php
Secure programming with phpSecure programming with php
Secure programming with php
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
 
The Internet of Insecure Things: 10 Most Wanted List
The Internet of Insecure Things: 10 Most Wanted ListThe Internet of Insecure Things: 10 Most Wanted List
The Internet of Insecure Things: 10 Most Wanted List
 
Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life Scenarious
 
Security Tips to run Docker in Production
Security Tips to run Docker in ProductionSecurity Tips to run Docker in Production
Security Tips to run Docker in Production
 
FIWARE Wednesday Webinars - How to Debug IoT Agents
FIWARE Wednesday Webinars - How to Debug IoT AgentsFIWARE Wednesday Webinars - How to Debug IoT Agents
FIWARE Wednesday Webinars - How to Debug IoT Agents
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
 
Mobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructureMobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructure
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
 
Reversing & malware analysis training part 12 rootkit analysis
Reversing & malware analysis training part 12   rootkit analysisReversing & malware analysis training part 12   rootkit analysis
Reversing & malware analysis training part 12 rootkit analysis
 
amrapali builders@@@hacking d link routers with hnap.pdf
amrapali builders@@@hacking d link routers with hnap.pdfamrapali builders@@@hacking d link routers with hnap.pdf
amrapali builders@@@hacking d link routers with hnap.pdf
 

Curl error 407 proxy authentication required

  • 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. 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!