将桌面应用程序与网站连接 [英] Connecting a desktop application with a website

查看:205
本文介绍了将桌面应用程序与网站连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Qt / C ++做一个应用程序,每5-7秒读取一些值,并将它们发送到网站。

I made an application using Qt/C++ that reads some values every 5-7 seconds and sends them to a website.

我的方法很简单。我只是读取我想发送的值,然后我做一个HTTP POST到网站。我也将用户名和密码发送到网站。

My approach is very simple. I am just reading the values i want to send and then i make an HTTP POST to the website. I also send the username and password to the website.

问题是我找不到请求是否成功。我的意思是,如果我发送请求和服务器得到它,我会得到一个HTTP:200总是。例如,如果密码不正确,则无法知道它。这是HTTP的工作方式。

The problem is that i cannot find out if the request is successful. I mean that if i send the request and server gets it, i will get an HTTP:200 always. For example if the password is not correct, there is no way to know it. It is the way HTTP works.

现在我想我需要一种协议来照顾应用程序和网站之间的通信。

Now i think i will need some kind of a protocol to take care the communication between the application and the website.

问题是使用什么协议?

推荐答案

响应头,您可以选择添加自定义状态。如果您的网站是基于PHP构建的,您可以调用 header()添加自定义

If the action performed completes before the response header is sent you have the option of adding a custom status to it. If your website is built on PHP you can call header() to add the custom status of the operation.

header('XAppRequest-Status: complete');

这篇关于将桌面应用程序与网站连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆