title: How to use php curl to get contacts from icontact?
body: <p>I am trying to get the list of contacts for my account in iContact using a php script. I can get the contact list using RestClient by entering the set of headers, the url and pressing go so I'm pretty sure my headers and url are correct. iContact provides example code for this task however when I run that (with my account and ap details) I get the same response as when I run the following code:</p>
  
  <pre><code>&lt;?php
  
      $Headers = array(
                  "Accept: text/xml",
                  "Content-Type: text/xml",
                  "API-Version: 2.2",
                  "API-AppId: grBddgWuirhAYT41K6gvrvRGaUGJFVQL",
                  "API-Username: &lt;removed&gt;",
                  "API-Password: &lt;removed&gt;");
  
      $Url = "https://app.sandbox.icontact.com/icp/a/412608/c/123920/contacts";
  
      $Handle    = curl_init();
      if(!$Handle)
      {
          die("Could not create a cURL handle.");
      }
  
      curl_setopt($Handle, CURLOPT_URL, $Url);
      curl_setopt($Handle, CURLOPT_HTTPHEADER, $Headers);
      curl_setopt($Handle, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15");
  
      curl_setopt($Handle, CURLOPT_RETURNTRANSFER, true);
      $Response = curl_exec($Handle);
  
      $iCode = curl_getinfo($Handle);
      echo "Response: &lt;br /&gt;";
      print_r($Response);
      echo "&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;";
      echo "Code: &lt;br /&gt;";
      print_r($iCode);
  
      curl_close($Handle);
  ?&gt;
  </code></pre>
  
  <p>This gives the out put:</p>
  
  <pre><code>Response:
  
  
  Code:
  Array ( [url] =&gt; https://app.sandbox.icontact.com/icp/a/412608/c/123920/contacts [content_type] =&gt; [http_code] =&gt; 0 [header_size] =&gt; 0 [request_size] =&gt; 0 [filetime] =&gt; -1 [ssl_verify_result] =&gt; 0 [redirect_count] =&gt; 0 [total_time] =&gt; 0.094 [namelookup_time] =&gt; 0 [connect_time] =&gt; 0.094 [pretransfer_time] =&gt; 0 [size_upload] =&gt; 0 [size_download] =&gt; 0 [speed_download] =&gt; 0 [speed_upload] =&gt; 0 [download_content_length] =&gt; -1 [upload_content_length] =&gt; -1 [starttransfer_time] =&gt; 0 [redirect_time] =&gt; 0 ) 
  </code></pre>
  
  <p>From what I understand of curl (which isn't very much at the moment) the http_code should be 200 and the xml should be in $Response.</p>
  
  <p>Could anyone point out what I'm doing wrong please?</p>
  
  <p>The iContact examples are available here:
  <a href="http://developer.icontact.com/documentation/code-library-zip-file/" rel="nofollow">http://developer.icontact.com/documentation/code-library-zip-file/</a></p>
  
  <p>I am trying to do what get_contacts.php should do.</p>