How to pass array of arguments to cURL in command line?
<p>I got desired response when i send <em>cURL</em> request from my <em>PHP</em> script.<br>
My request is like this.  </p>

<pre><code>$data = array ("[product[name]]" =&gt; "nw",
               "[product[handle]]" =&gt; 150,
               "[product[interval_unit]]" =&gt; "day",
               "[product[interval]]" =&gt; 1,
               "[product[price_in_cents]]" =&gt; 0,
               "[product[initial_charge_in_cents]]" =&gt; 14200,
               "[product[return_url]]" =&gt;"http://mytrial.com/office/selfie/themes/adcampaign/56cee935-185c-4dfs-asdfa-2b6b0ae84a4d",
               "[product[return_params]]" =&gt; "id={subscription_id}&amp;customer_id={customer_id})");
$url="http://mytrial.com/office/selfie/themes/adcampaign/346423/products.json";
$ch  = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, 'sdfkjas2kjsd:x');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$res  = curl_exec($ch);
curl_close($ch);       
</code></pre>

<p>It's working properly. I want to do the same request in command line.First i json encoded the array and i tried with this commands  </p>

<pre><code> curl -u sdfkjas2kjsd:x -H Accept:application/json -H Content-Type:application/json -x POST --data product[name]=nw&amp;product[handle]=142&amp;product[interval_unit]=day&amp;product[interval]=1&amp;product[price_in_cents]=0&amp;product[initial_charge_in_cents]=14400&amp;product[return_url]=http:\/\/54.145.218.63\/dev_lpad\/launchpad\/advertisers\/adcampaign\/56cee935-185c-4349-a8a1-2b6b0ae84a4d&amp;product[return_params]={id={subscription_id}&amp;customer_id={customer_id}}  http://mytrial.com/office/selfie/themes/adcampaign/346423/products.json  
</code></pre>

<p>Then i got the error.</p>

<blockquote>
  <p>Error: Unable to parse request body  </p>
</blockquote>

<p>Is there any way to solve this?  </p>

<blockquote>
  <p><strong>UPDATE</strong> : The URL provided here is a dummy value,Actually i am trying to connect with <strong><em>Chargify API</em></strong> (Recurring  billing solution ).</p>
</blockquote>