title: Laravel rest api authentication
body: <p>I am a beginner with building a rest api and authentication.
  I've just been reading the following and explains a very simple setup:</p>
  
  <p><a href="https://www.codetutorial.io/laravel-5-rest-api-basic-authentication/" rel="nofollow">laravel 5 rest api basic authentication</a></p>
  
  <p>At the bottom the article explains not to send usernames and password with headers or in the url.</p>
  
  <p>My question is basicly: can anyone give me an example how to use a cUrl request with the example above?</p>
  
  <p>For example: </p>
  
  <pre><code>$service_url = 'http://example.com/api/conversations';
  $curl = curl_init($service_url);
  $curl_post_data = array(
          'user' =&gt; 'user@user.com',
          'passw' =&gt; '1234'
  );
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
  $curl_response = curl_exec($curl);
  
  curl_close($curl);
  </code></pre>