title: CURL Unable to find error in code
body: <pre><code>&lt;?php
      $ch = curl_init("URL");
      $username = "USERNAME";
      $password = "PASSWORD";
      $fields = array("from"=&gt;array("name"=&gt;"Bob","city"=&gt;"SAINT-LAURENT","country"=&gt;"CA","state"=&gt;"QC","postal_code"=&gt;"H4R1W4"),"to"=&gt;array("is_commercial"=&gt;true,"city"=&gt;"ANJOU","country"=&gt;"CA","state"=&gt;"QC","postal_code"=&gt;"H1J1Z4"),"packages"=&gt;array("units"=&gt;"imperial","type"=&gt;"package","items"=&gt;array("width"=&gt;1,"height"=&gt;2,"length"=&gt;3,"weight"=&gt;4)));
      curl_setopt($ch,CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
      curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
      curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($fields));        
      $data = curl_exec($ch);
      if ($data === FALSE) 
      { 
          $temp=curl_error($ch);
          echo "&lt;p&gt;cURL Error: {$temp}&lt;/p&gt;";
      }
      echo "&lt;pre&gt;";
      print_r($data);
      curl_close($ch);
  ?&gt;
  </code></pre>
  
  <p>Error I got is </p>
  
  <pre><code>  {"error": "Unexpected input. Please make sure this is a valid JSON document"}
  </code></pre>
  
  <p>I'm unable to understand what this meant .<br>
  <strong>After Update</strong> the error i get is<br>
  Argument 1 passed to Support\ExposedObjectAbstract::setFromArray() must be of the type array, integer given, called in Shipping/Packages.php on line 22 and defined</p>