title: Sending POST data to an API using cURL
body: <p>I can send sms using the following form </p>
  
  <pre><code>&lt;form action="http://myserviceprovider/myname/server.php" method="post"&gt; 
   &lt;input  type="hidden" value="MyUsername" name="user" /&gt;   
   &lt;input  type="hidden" value="MyPassword" name="pass" /&gt;           
   &lt;input  type="hidden" value="MyKey" name="sid" /&gt;    
   &lt;input  type="hidden" value="12345678" name="sms[0][0]" /&gt; 
   &lt;input  type="hidden" value="MyFrist SMS Text" name="sms[0][1]" /&gt;
   &lt;input  type="hidden" value="97654321" name="sms[1][0]" /&gt;                    
   &lt;input  type="hidden" value="MySecond SMS Text" name="sms[1][1]" /&gt;
   &lt;input type="submit" /&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>Now I am trying to send sms using PHP cURL. I have created an array which contains cellphone numbers and messages:</p>
  
  <pre><code>$sms =array(
             array("0" =&gt; "12345678", "1" =&gt; "MyFrist SMS Text"),
             array("0" =&gt; "97654321", "1" =&gt; "MySecond SMS Text")
        );
  </code></pre>
  
  <p>The problem is I cannot figure out how exactly to send the values including username,password and Mykey using the following </p>
  
  <pre><code>$ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  curl_exec($ch);
  </code></pre>
  
  <p>Could you please tell how to solve this problem?</p>