title: curl http auth work perfect in command line but on php not
body: <p>Hello i have command line code:</p>
  
  <pre><code>curl 'http://192.168.0.1:80/' -H 'Authorization: Basic my_auth'
  </code></pre>
  
  <p>In php:</p>
  
  <pre><code>$process = curl_init($ip);
  //just for "shore"
              curl_setopt($data, CURLOPT_HTTPHEADER,
              array(
                "Authorization: Basic " . base64_encode($username . ":" . $password)
              ));
              curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
              curl_setopt($process, CURLOPT_USERPWD, $login . ":" . $password);
              curl_setopt($process, CURLOPT_CONNECTTIMEOUT, 10);
              curl_setopt($process, CURLOPT_TIMEOUT, 10);
  
              curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt($process, CURLOPT_VERBOSE, 1);
              curl_setopt($process, CURLOPT_HEADER, 1);
  
              $return = curl_exec($process);
  </code></pre>
  
  <p>in result i see: 401...
  In apache2 log:</p>
  
  <blockquote>
    <ul>
    <li>HTTP 1.0, assume close after body &lt; HTTP/1.0 401 Unauthorized &lt; Date: Fri, 15 Jul 2016 09:27:20 GMT &lt; Server: Boa/0.94.13 &lt;
    Connection: close &lt; WWW-Authenticate: Basic realm="service" &lt;
    Content-Type: text/html; charset=ISO-8859-1 &lt; Set-Cookie:
    SESSIONID=068054d0; &lt; </li>
    <li>Closing connection 53</li>
    <li>Issue another request to this URL: ''</li>
    <li>Hostname was found in DNS cache</li>
    <li>Trying 192.168.0.1...</li>
    <li>Connected to 192.168.0.1 (192.168.0.1) port 80 (#54)</li>
    <li><p>Server auth using Basic with user 'admin'</p>
    
    <blockquote>
      <p>GET / HTTP/1.0 Authorization: Basic my_code Host: 192.168.0.1 Accept: <em>/</em></p>
    </blockquote></li>
    <li><p>HTTP 1.0, assume close after body &lt; HTTP/1.0 401 Unauthorized &lt; Date: Fri, 15 Jul 2016 09:27:20 GMT &lt; Server: Boa/0.94.13 &lt;
    Connection: close</p></li>
    <li>Authentication problem. Ignoring this. &lt; WWW-Authenticate: Basic realm="service" &lt; Content-Type: text/html; charset=ISO-8859-1 &lt;
    Set-Cookie: SESSIONID=068054d0; &lt; </li>
    <li>Closing connection 54</li>
    </ul>
  </blockquote>