如何将带有URL的变量传递给libcurl

时间:2017-05-28 09:59:18

标签: c++ variables libcurl

我有这一行:

curl_easy_setopt(curl, CURLOPT_URL, "https://bk-bestgamer.ru/get.php?get=hello");

它工作正常。我发送请求并收到一行包含文字"你好"来自我的网站。 但是当我喜欢这个时

std::string url;
std::cin >> url;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());`

之后,当我使用

curl_easy_perform(curl);`

我有一个错误 在libcurl"中不支持或禁用#34;协议https。 我试着做以下

char url[] = "https://bk-bestgamer.ru/get.php?get=hello";
curl_easy_setopt(curl, CURLOPT_URL, url);`

它不会处理同样的错误。 我真的不知道该怎么办。 我在那里找到了一些建议 URL Variable passing into Curl 你可以看到,我试过了,但它并没有成功。

我试图在ubuntu中编译相同的代码,其中我有libsl和ssl。但它不会处理相同的错误。从linux命令行,它可以正常工作。

0 个答案:

没有答案
相关问题