title: Submit form using curl php
body: <p>I am trying to send SMS through a website using a PHP script and here is the code</p>
  
  <pre><code>function send_sms($phone,$message)
  {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, 'http://www.fullonsms/home.php');
      curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64)       AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107     Chrome/32.0.1700.107 Safari/537.36');
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, "MobileNos=".$phone."&amp;message=".$message);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
      curl_setopt($ch, CURLOPT_COOKIESESSION, true);
      curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');  
      $text=curl_exec($ch);
      echo curl_getinfo($ch, CURLINFO_REDIRECT_URL);
  }
  send_sms("1234567890","hi");
  </code></pre>
  
  <p>I have already made an account on this website www.fullonsms.com and now I am trying to send text message using my account. The ID of the form elements are MobileNos and message. Can you please tell me why this is not working. Am I missing something or is this completely wrong approach?</p>