[Solved]How to send text to a website from a Qt desktop application and get back results?
-
wrote on 23 Mar 2013, 16:37 last edited by
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?). -
wrote on 23 Mar 2013, 17:36 last edited by
[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.
-
wrote on 23 Mar 2013, 17:43 last edited by
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_QtCheck also the documentation of the classes mentioned in that article.
-
wrote on 23 Mar 2013, 18:01 last edited by
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? -
wrote on 23 Mar 2013, 18:40 last edited by
[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 -
wrote on 23 Mar 2013, 18:58 last edited by
[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/docYou can use Qt-classes to create such a POST-request and to send it to their request handler (API endpoint, as it called there).
-
wrote on 24 Mar 2013, 10:14 last edited by
Thank you all for the help.
4/7