any PHP/HTML experts here?

Discussion in 'Questions (Windows Mobile)' started by Cableguy, Sep 26, 2008.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi guys...

    I need to submit a web form in a automatic way...
    The form uses "action=" and "method="POST""
    I can easely gather the information I need to send, including the "hidden" names and values...
    But how do i arrange this data in my httprequest?
    It would be MUCH easier to simulate a click on the submit button, but it is somehow iludding me...
     
  2. gmeader

    gmeader New Member

    Use the Javascript submit method

    Use the Javascript submit method.

    Example form:
    <form name="myform" action="handle-data.php">
    </form>

    <SCRIPT language="JavaScript">
    document.myform.submit();
    </SCRIPT>
     
  3. Cableguy

    Cableguy Expert Licensed User

    Thanks for the tip...
    i got it workin by sending a click to the button...
     
  4. bish0p

    bish0p Member Licensed User

    The other option is to really not interact with the form at all and just send the information, in a POST method call.

    Code:
    wwwreq.Method="POST"
    wwwreq.ContentType = 
    "application/x-www-form-urlencoded"
    writer.New1(wwwreq.GetStream,
    True)
    s =
    "myUsername="&html.UrlEncode(username)&"&myPassword="&html.UrlEncode(password)&"&Button1=Login&__VIEWSTATE="&Viewstate&"&cookie=on"
    buffer() = 
    bit.StringToBytes(s,0,StrLength(s))
    writer.WriteBytes(buffer())
    Post is pretty simple really, all you need to do is create a string (in this example s) that is of the format varable=answer&varable=answer the answers must be URLencoded.

    Other than that all I am doing is setting the method to POST and telling the server to expect everything in URLencoded form.

    wwwreq is of corse a http request object and bit is a bitwize object, and writer is a binaryfile object.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice