使用 qt creator 在带有 https 的网站上获取一些值
Getting some values using qt creator on a website with https
所以我目前正在用QTCreator 5.0构建一个小应用程序。我尝试构建一个允许我连接到网站的应用程序(使用 HTTPS 而不是 HTTP)。到目前为止,我认为我能够将一些东西放在一起,但我遇到了麻烦(当然我确信这与http和https有关,但我不完全确定如何解决它)。
我收到此错误:
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error
QSslSocket: cannot call unresolved function ERR_get_error
这是我提出的一些代码:
QString str;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
m_manager = new QNetworkAccessManager(this);
connect(m_manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(replyFinished(QNetworkReply*)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::fetch()
{
m_manager->get(QNetworkRequest(QUrl("https://btc-e.com/api/2/btc_usd/ticker")));
}
void MainWindow::replyFinished(QNetworkReply* pReply)
{
QByteArray data = pReply->readAll();
QString str(data);
}
void MainWindow::on_pushButton_clicked()
{
fetch();
ui->textBrowser->setText(str);
}
我看了如何获取网页的内容,它可能相关,但我不完全确定这是否适用于https
谢谢!
添加这个作为答案:
-
你应该链接到openssl。
-
您需要将
ui->textBrowser->setText
移动到replyFinished
插槽。
相关文章:
- C++为构建时间获取QDateTime的可靠方法
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 使用指针从C++中的数组中获取最大值
- 如何获取std::result_of函数的返回类型
- 如何在openssl-ecc中获取十六进制格式的私钥
- 如何从网站获取数据并将其传输到数据库?
- 使用 qt creator 在带有 https 的网站上获取一些值
- 获取网站来源,获取额外的符号,winsock
- 是否需要QtWebkit从需要登录的网站获取数据
- 如何从QWebEnginePage获取网站内容
- 从网站实时获取数据
- 如何使用C++从网站获取输入
- 获取网站的HTML
- 如何在连接到网站时获取信息
- 获取网站来源
- 从网站获取文本
- 我需要从一个网站在c++中获取天气信息
- 获取网站的端口号
- 使用C++获取网站缩略图快照