×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    7

    Question http POST, help needed!

    Hi

    What i'm doing wrong here?
    I just want to send text "name=next" to server http://192.168.0.199:38402.

    QHttpRequestHeader header("POST", "/", 1, 1);
    header.setValue("Host", "http://192.168.0.199:38402");
    header.setContentType("application/x-www-form-urlencoded");

    QString searchString = "name=next";
    http->request(header,searchString.toUtf8());


    What i really need is message like this:

    (this is from firefox plug-in "Live http headers")
    POST / HTTP/1.1
    Host: 192.168.0.199:38402
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fi; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: fi-fi,fi;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Referer: http://192.168.0.199:38402/
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 9
    name=next

  2. #2
    Registered User
    Join Date
    Oct 2007
    Posts
    7

    Re: http POST, help needed!

    Ok, i found solution with try-error-technique.

    Problem was how to indicate QHttp and header host's.

    QString searchString = "name=next";
    QString host = "http://192.168.2.103:38402/";

    file->open(QIODevice::WriteOnly);
    http->setHost("192.168.2.103", 38402);

    connect(http, SIGNAL(done(bool)), this, SLOT(httpDone()));

    QHttpRequestHeader header("POST", "/index.html");
    header.setValue("Host", "host");
    header.setContentType("text/html");

    http->request(header,searchString.toUtf8());

    -Olavi

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    15

    Re: http POST, help needed!

    Cannot understand what is the problem you have come across and how you solved that.

Similar Threads

  1. Problem with HTTP POST
    By thathoo in forum Mobile Java General
    Replies: 2
    Last Post: 2006-12-18, 18:23
  2. Using HTTP POST & Nokia 6600 to upload octet stream to server
    By ssandor in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-09-19, 11:00
  3. Http Post
    By maimonides in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-05-17, 07:49
  4. Replies: 0
    Last Post: 2002-05-09, 12:07
  5. HTTP POST?
    By dennisluemkemann in forum Mobile Java General
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •