title: Convert cURL request to Guzzle PHP
body: <p>I am trying to convert existing cURL request to Guzzle 6. This is the cURL request. The code for curl request is like this.</p>
  
  <pre><code>$xml = file_get_content('new.xml');
  
  // Initialize handle and set options
  $ch = curl_init();
  
  curl_setopt( $ch, CURLOPT_URL,     $this-&gt;xml_post_url );//
  curl_setopt( $ch, CURLOPT_SSLCERT, $this-&gt;sslcert );//
  curl_setopt( $ch, CURLOPT_SSLKEY,  $this-&gt;sslkey );//
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $raw_request );
  curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
  curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 20 );
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Connection: close') );
  curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt( $ch, CURLOPT_SSLCERTPASSWD, $this-&gt;sslcertpasswd );
  curl_setopt( $ch, CURLOPT_SSLKEYPASSWD,  $this-&gt;sslkeypasswd );
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // capture the response to a string
  
  // give it 3 tries
  for ($i=1; $i&lt;=3; ++$i) {
  
      $raw_response = curl_exec($ch);
      $response_HTTP_CODE = (int) curl_getinfo( $ch, CURLINFO_HTTP_CODE );
  
      if (200 &lt;= $response_HTTP_CODE and $response_HTTP_CODE &lt; 400) {
  
          if ($raw_response !== false) {
  
              curl_close( $ch );
              return $raw_response;
  
          }
  
      }
      elseif (500 &lt;= $response_HTTP_CODE and strlen( $raw_response ) &gt; 0) {
  
          $offset = strpos( $raw_response, '&lt;errortext&gt;');
  
          if ($offset !== false) {
  
              curl_close( $ch );
              break;
  
          }
      }
  
      sleep( 1 ); // give it a moment
  }
  
  curl_close( $ch );
  </code></pre>
  
  <p>Is there anyway to convert this into Guzzle request in sane way with retry option as well if possible.</p>
  
  <p>This is what I tried</p>
  
  <pre><code>$request = $this-&gt;getClient()-&gt;post($this-&gt;request['endPointUrl'], [
          'body' =&gt; $xml,
          'cert' =&gt; $this-&gt;request['sslCert'],
          'config' =&gt; [
              'curl' =&gt; [
                  CURLOPT_SSLVERSION =&gt; CURL_SSLVERSION_TLSv1,
                  CURLOPT_SSL_VERIFYHOST =&gt; false,
                  CURLOPT_SSL_VERIFYPEER =&gt; false,
                  CURLOPT_RETURNTRANSFER =&gt; true
              ]
          ]
      ]);
      $response = $request-&gt;send()-&gt;xml();
  </code></pre>
  
  <p>But I am getting cURL exception.</p>