Problems with username or pass with colon when setting CURLOPT_USERPWD

后端 未结 3 897
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-19 06:40

We are trying to use curl in PHP5 to login to a website using basic authentication.

Partial code is like this:



        
3条回答
  •  清酒与你
    2020-12-19 07:04

    It looks like there is no documented solution, but you could try this workaround:

    curl_setopt($ch, CURLOPT_URL, "http://{$uname}:{$pass}@www.test.com/login.php");
    

    But i have not tested it..

提交回复
热议问题