Menu

Please Help! Send POST form request.

mtmaster
2011-04-20
2013-04-25
  • mtmaster

    mtmaster - 2011-04-20

    Please help me!

    I have a html form like this:

    <form method="post" action="http://dfreesms.com/in.php"; > <input type="text" name="f_phone" value="" maxlength="20" /><br> <textarea name="f_msg" cols="28" rows="5" maxlength="150" ></textarea><br> <input class="submitButton" type="submit" style="height:2.1em; width:12em;" value="" /><br> </form>

    I would like to send a POST request to php server (just like the html form above) with MidletPascal.
    However, what I have tried did not work. I don't know why.
    Assume the values I want to send is:

    f_phone=84909674700
    f_msg=hello

    Here is what I tried:

    htmlbody := 'f_phone=84909674700&f_msg=hello';
      setHttpMethod(connect, POST);
      if not openHttp(connect, 'http://dfreesms.com/in.php') then halt;
      addHttpHeader(connect, 'User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0');
      addHttpHeader(connect, 'Content-Type','application/x-www-form-urlencoded');
      addHttpHeader(connect, 'Content-Length', integertoString(length(htmlbody)));
      addHttpBody(connect, htmlbody);
      if sendHttpMessage(connect) <> 200 then halt;
      closeHttp(connect);

    After I send that request, the server return a page just like I didn't send anything to it (no SMS sent).

    The GET method not work with this site! So the URL http://dfreesms.com/in.php?f_phone=84909674700&f_msg=hello will not work!

    Please help me find out what wrong with my code! Please!
    Thanks.

     
  • mtmaster

    mtmaster - 2011-04-20

    I repost the html source

    <form method="post" action="http://dfreesms.com/in.php" >
    <input type="text" name="f_phone" value=""  maxlength="20" /><br>
    <textarea name="f_msg" cols="28" rows="5"  maxlength="150" ></textarea><br>
    <input  class="submitButton" type="submit" style="height:2.1em; width:12em;" value="Send" /><br>
    </form>

     
  • mtmaster

    mtmaster - 2011-04-20

    The html works but my midlet not work at all. If I worked, you could send free SMS from your phone with this:
    http://www.mediafire.com/download.php?wpnqqxu49txd1ad
    Tell me if it works for you!
    Here is the link to the html source above: http://tempsms.cu.to

     

Log in to post a comment.