title: Curl PHP Basic HTTP Authentication return 405 error
body: <p>The method</p>
  
  <pre><code>/user/role/authenticate
  </code></pre>
  
  <p>on my webserver API does require HTTP authentification in form of username and password.</p>
  
  <p>I use the following code to access the API of my webserver from a different frontend, that is designed with CodeIgniter.</p>
  
  <pre><code>$URL='http://.../user/role/authenticate'; 
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$URL);
  curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  curl_setopt($ch, CURLOPT_USERPWD, "testusername:testpassword");
  $result=curl_exec ($ch);        
  $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
  echo $status_code;
  print_r($result);
  curl_close ($ch);
  </code></pre>
  
  <p>But I get the result ,,405: Method not allowed".</p>
  
  <p>What to do?</p>