title: CapsuleCRM API ColdFusion Wrapper
body: <p>Looking for a ColdFusion version of the following PHP API wrapper for CapsuleCRM:</p>
  
  <pre><code>&lt;?php
  // The data you want to send to Capsule CRM in xml format 
  // SEE http://capsulecrm.com/help/page/javelin_api_party
  </code></pre>
  
  <p>I'm understanding that this variable contains the XML string...</p>
  
  <pre><code>$myxml="&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n
  &lt;person&gt;\n
  &lt;title&gt;Mr&lt;/title&gt;\n
  &lt;firstName&gt;Test12&lt;/firstName&gt;\n
  &lt;lastName&gt;Tester12&lt;/lastName&gt;\n
  &lt;jobTitle&gt;Chairman&lt;/jobTitle&gt;\n
  &lt;organisationName&gt;Big Company&lt;/organisationName&gt;\n
  &lt;about&gt;Testing&lt;/about&gt;\n
  &lt;/person&gt;";
  
  // The URL to connect with (note the /api/ that's needed and note it's person rather than party) 
  // SEE: http://capsulecrm.com/help/page/api_gettingstarted/
  $capsulepage =  'https://sample.capsulecrm.com/api/person';
  </code></pre>
  
  <p>However, I don't know how to initiate cURL in ColdFusion.</p>
  
  <pre><code>// Initialise the session and return a cURL handle to pass to other cURL functions.
  $ch = curl_init($capsulepage);
  </code></pre>
  
  <p>What does the 'curl_setopt_array' function do exactly? Is there a CF equivalent?</p>
  
  <pre><code>// set appropriate options NB these are the minimum necessary to achieve a post with a useful response
  // ...can and should add more in a real application such as 
  // timeout CURLOPT_CONNECTTIMEOUT 
  // and useragent CURLOPT_USERAGENT
  // replace 1234567890123456789 with your own API token from your user preferences page
  $options = array(CURLOPT_USERPWD =&gt; '1234567890123456789:x',
          CURLOPT_HTTPHEADER =&gt; array('Content-Type: text/xml'),
          CURLOPT_HEADER =&gt; true,
          CURLOPT_RETURNTRANSFER =&gt; true,
          CURLOPT_POST =&gt; true,
          CURLOPT_POSTFIELDS =&gt; $myxml
              );
  curl_setopt_array($ch, $options); 
  
  // Do the POST and collect the response for future printing etc then close the session
  $response = curl_exec($ch);
  $responseInfo = curl_getinfo($ch);
  curl_close($ch);
  ?&gt;
  </code></pre>