[Solved]How to send text to a website from a Qt desktop application and get back results?



  • I want to send plain text or html code to a website from a qt desktop application, the website must check it from spam, then retrieve results from website in desktop application.
    How can I do this? I can’t seem to find specific wiki for this (I don’t know what to look for).
    I posted this in Qt Webkit also(mistake?).



  • [quote author="ogrishmania" date="1364056636"]
    How can I do this? I can’t seem to find specific wiki for this (I don’t know what to look for).[/quote]

    Check this simple example for "data download at our Wiki":http://qt-project.org/wiki/Download_Data_from_URL

    [quote author="ogrishmania" date="1364056636"]
    I posted this in Qt Webkit also(mistake?).[/quote]

    Yes, you should avoid duplication. The other thread must be closed.



  • You can communicate with your web server via http. You'll need to formulate a http-request in your application and there must be a request-handler on the server side that performs some operation with the payload in your request (spam checking in your case) and sends back a replay.
    Maybe this link can give you some ideas about how to do this:
    :http://www.developer.nokia.com/Community/Wiki/Creating_an_HTTP_network_request_in_Qt

    Check also the documentation of the classes mentioned in that article.



  • But it is not my server or my website. It's a random website that checks email text or html code for spam.
    Let's say I use "this":http://www.emailspamtest.com/# website. I want my app to send some text or html code to the appropriate fields on that webpage and then get the result from the server. Is it possible since it's not my website or my server?



  • [quote author="ogrishmania" date="1364061704"]But it is not my server or my website. It's a random website that checks email text or html code for spam.
    Let's say I use "this":http://www.emailspamtest.com/# website. I want my app to send some text or html code to the appropriate fields on that webpage and then get the result from the server. Is it possible since it's not my website or my server?[/quote]

    You can use QNetworkAccessManager::post().
    I see that the site doesn't have an API but if you try to see the source code of the page, it uses a "form" for submitting data. I think you can use QHttpMultiPart for this, though I don't recommend using it because of some past problems I encountered. I recommend using "FormPost":http://www.tuckdesign.com/sources/Qt



  • [quote author="ogrishmania" date="1364061704"]But it is not my server or my website. It's a random website that checks email text or html code for spam.
    Let's say I use "this":http://www.emailspamtest.com/# website. I want my app to send some text or html code to the appropriate fields on that webpage and then get the result from the server. Is it possible since it's not my website or my server?[/quote]

    I'd rather use a service with a well documented API. A quick search lead me to
    http://spamcheck.postmarkapp.com/doc

    You can use Qt-classes to create such a POST-request and to send it to their request handler (API endpoint, as it called there).



  • Thank you all for the help.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.