IdHTTP以确保将数据推送到Ubidots(FMX,WIN32) [英] IdHTTP to ensure push data to Ubidots (FMX, WIN32)

查看:177
本文介绍了IdHTTP以确保将数据推送到Ubidots(FMX,WIN32)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只需将以下URL加载到Web浏览器中,我就可以将一份加密的湿度数据推送到我的Ubidots云数据库中:

I can push an encrypted piece of humidity data up to my Ubidots cloud database by simply loading the following url in a web browser:

https://industrial.ubidots.com/api/v1.6/devices/MYDEVICENAME/?token=MYTOKENHERE&_method=post&湿度= 15.9

这样做时,我会在浏览器窗口中获得成功响应

When I do that, I get the success response in the browser window

{"humidity": [{"status_code": 201}]}

数据显示在我的Ubidots数据表中.

and the data shows up in my data table on Ubidots.

现在,我想从没有可见浏览器的FMX应用程序(Win32上的C ++)执行此操作,并且我想检查是否获得了不错的"201"响应代码.我查看了此链接,并整理了以下代码行:

Now, I want to do this from an FMX app (C++ on Win32) without a visible browser, and I would like to check that I get the nice "201" response code. I looked at this link and cobbled up the following line of code:

Memo1->Text = IdHTTP1->Get("https://industrial.ubidots.com/api/v1.6/devices/MYDEVICENAME/?token=MYTOKENHERE&_method=post&humidity=6.9");

运行它时,出现无法加载SSL库"错误消息.如何告诉TIdHTTP使用SSL,以便它可以处理HTTPS?有没有更好,更清洁的方法?

When I run it, I get a "Could not load SSL library" error message. How do I tell TIdHTTP to use SSL so it can handle the HTTPS? Is there a better, cleaner way to do this?

推荐答案

我收到无法加载SSL库"错误消息.

I get a "Could not load SSL library" error message.

Indy默认情况下使用OpenSSL.您可以在IdSSLOpenSSLHeaders.hpp中使用Indy的WhichFailedToLoad()函数来找出为什么它无法加载OpenSSL库的原因.

Indy uses OpenSSL by default. You can use Indy's WhichFailedToLoad() function in IdSSLOpenSSLHeaders.hpp to find out why it couldn't load the OpenSSL library.

如何告诉IdHTTP1使用SSL

How do I tell IdHTTP1 to use SSL

通过请求HTTP S 网址,您已经是. Indy只是在加载SSL库时遇到了麻烦,要么是因为它找不到库二进制文件,要么是您的二进制文件版本错误.您可以从 https://indy.fulgan.com/SSL/获取与Indy兼容的OpenSSL二进制文件.通常,您应该将它们放置在与应用程序相同的文件夹中,但是如果要将它们存储在其他位置,则需要在调用任何SSL/TLS操作之前调用Indy的IdOpenSSLSetLibPath()函数.

You already are, by virtue of requesting an HTTPS url. Indy is simply having trouble loading the SSL library, either because it can't find the library binaries, or you have the wrong versions of the binaries. You can get Indy compatible OpenSSL binaries from https://indy.fulgan.com/SSL/. Typically you should place them in the same folder as your app, but if you want to store them somewhere else then you need to call Indy's IdOpenSSLSetLibPath() function before invoking any SSL/TLS operations.

这篇关于IdHTTP以确保将数据推送到Ubidots(FMX,WIN32)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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