title: Laravel 5.5 - Guzzle 6 curl error 51
body: <p>I'm working on upgrading a project from Laravel 5.2 to 5.5 and with that, Guzzle is updating from 5 to 6. I am making a curl request to an external API, and I cannot get the cert to work with the new structure. I keep getting cURL error 51.</p>
  
  <p>Guzzle 5 Code</p>
  
  <pre><code>$opts = [
    'base_url' =&gt; rtrim($this-&gt;url, '/') . '/',
    'defaults' =&gt; [
      'headers' =&gt; [
        'Authorization' =&gt; $this-&gt;shared_key,
        'Accept' =&gt; 'application/json',
      ],
      'connect_timeout' =&gt; 5,
      'timeout' =&gt; 60,
    ],
  ];
  
  // if a ca certificate is specified, validate against it
  if ($this-&gt;ssl_ca_store) {
    // create a temp file containing the cert since curl can only read from a file
    $this-&gt;sslCaTempFile = tempnam(sys_get_temp_dir(), 'translator-cert-');
    file_put_contents($this-&gt;sslCaTempFile, $this-&gt;ssl_ca_store);
    $opts['defaults']['config']['curl'] = [
      CURLOPT_CAINFO =&gt; $this-&gt;sslCaTempFile,
      CURLOPT_SSL_VERIFYPEER =&gt; 2, // validate the peer certificate
      CURLOPT_SSL_VERIFYHOST =&gt; 0, // don't validate the hostname in the certificate
    ];
  }
  
  // create the client with the options from above
  $this-&gt;client = new Client($opts);
  </code></pre>
  
  <p>Guzzle 6 code</p>
  
  <pre><code>$opts = [
    'base_uri' =&gt; rtrim($this-&gt;url, '/') . '/',
    'headers' =&gt; [
      'Authorization' =&gt; $this-&gt;shared_key,
      'Accept' =&gt; 'application/json',
    ],
    'connect_timeout' =&gt; 5,
    'timeout' =&gt; 60,
  ];
  
  // if a ca certificate is specified, validate against it
  if ($this-&gt;ssl_ca_store) {
    // create a temp file containing the cert since curl can only read from a file
    $this-&gt;sslCaTempFile = tempnam(sys_get_temp_dir(), 'translator-cert-');
    file_put_contents($this-&gt;sslCaTempFile, $this-&gt;ssl_ca_store);
    $opts['curl'] = [
      CURLOPT_CAINFO =&gt; $this-&gt;sslCaTempFile,
      CURLOPT_SSL_VERIFYPEER =&gt; 2, // validate the peer certificate
      CURLOPT_SSL_VERIFYHOST =&gt; 0, // don't validate the hostname in the certificate
    ];
  }
  
  // create the client with the options from above
  $this-&gt;client = new Client($opts);
  </code></pre>
  
  <p>EDIT: This is the request it is failing on:</p>
  
  <pre><code>$response = $this-&gt;client-&gt;request('get', 'auto-verify', [
    'query' =&gt; [
      'type' =&gt; $this-&gt;type,
      'identifier' =&gt; $this-&gt;identifier,
    ],
  ]);
  </code></pre>