burakc Posted June 13, 2012 Share Posted June 13, 2012 Hi, I am trying to connect a web page. Its protected by 401 (htpasswd prot.) and Form login (http session prot.). My codes passing 401 pop up screen. But after that form login screen showing error: wrong password. How can i pass both of them. Sorry for my poor English. Thanks. $curl = curl_init(); $timeout = 10; curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; curl_setopt($curl, CURLOPT_USERPWD, "$htuser:$loginPassword"); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, 'User='.$loginUser.'&password='.$loginPassword.'&submit='.$submit); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($curl, CURLOPT_URL, $url); $data = curl_exec($curl); print_r($data); curl_close($curl); Quote Link to comment https://forums.phpfreaks.com/topic/264092-advanced-curl-help-need/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.