问题描述
我正在尝试连接到在线API,获取网站上的所有文本,然后将其复制并粘贴到字符串中。
URL为https://api.hypixel.net/skyblock/bazaar?key=[KEYHERE] 还有https://api.hypixel.net/skyblock/profile?key=[MyKey]&profile=[MyProfile] (该网址已被检查)。
到目前为止,这是我的代码:
#include <iostream>
#include <windows.h>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
string URLPurse = "https://api.hypixel.net/skyblock/profile?key=[MyKey]&profile=[MyProfile]";
string URLEnder = "https://api.hypixel.net/skyblock/bazaar?key=[MyKey]";
//read text from both APIs
string answerPurse = [text from the player api];
string answerEnder = [text from the bazzar api];
// Do stuff with the text
}
我是编程的新手,我不知道如何下载或使用cURL,但是有没有外部库的方法吗?如果没有,您能否解释我如何下载和使用cURL来实现这一目标? (我正在使用Windows 7和32位和Code :: Blocks)。我也不能使用其他任何编程语言,例如java。
(我知道我使用了太多的库)
解决方法
尝试使用硒,它在python中,我相信c ++也可以,您可以定位html元素并根据需要使用它们