title: Sending username and password with cURL
body: <p>I'm trying to access an API using php cURL. The docs say:</p>
  
  <blockquote>
    <p>Each request must include the API Key that was assigned to the email
    partner. It should be</p>
    
    <p>presented to the server via standard Basic HTTP authentication (as
    defined in RFC2617) as</p>
    
    <p>the username with an empty password.</p>
  </blockquote>
  
  <p>How do I send the API key as the username and leave the PW empty? Here is what I have so far:</p>
  
  <pre><code>$subscriberInfo = [
      'email' =&gt; $email,
      'search' =&gt; $jobType,
      'location' =&gt; $location
  ];
  
  $ch = curl_init('https://api.ExternalSiteHere');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $subscriberInfo);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Content-Type: multipart/form-data'
      ));
  
  // execute!
  $response = curl_exec($ch);
  
  // close the connection
  curl_close($ch);
  
  var_dump($response);
  die();
  </code></pre>