1
我有一個插件,我已經使用了一段時間,它基本上只是使用套接字來發送請求。問題是,當您在遊戲服務器上使用插件時,您必須首先登錄到計算機上的SteamCommunity.com以存儲Cookie。我想通過首先使用HTTPS連接到網站來將其轉換爲C++以緩解該步驟。自從我使用LibCurl已經很長時間了,我沒有太多的運氣來找到我需要設置的信息。C++ LibCurl發送HTTPS請求
基本上我只是想知道如果我正在做這個正確的方式,以及我需要使用其他CURLOPT_設置。
void InviteToGroup(const char *pszAuthID)
{
CURL *curl;
CURLcode res;
const char *szCommunityID = GetCommunityID(pszAuthID); // User's Steam Community ID
const char *szCookie = "76561198018111441%7C%7CC7D70E74A3F592F3E130CCF4CAACD4A7B9CAD993"; // Steam Community Login Cookie
const char *szInviter = "76561194018311441"; // Inviter's Steam Community ID
const char *szGroup = "103583791430784257"; // Group Steam Community ID
const char *request = new char[2048];
snprintf(request, 2047, "GET /actions/GroupInvite?type=groupInvite&inviter=%s&invitee=%s&group=%s HTTP/1.1\r\nHost: steamcommunity.com\r\nConnection: close\r\nCookie: steamLogin=%s\r\n\r\n", szInviter, szCommunityID, szGroup, szCookie);
curl = curl_easy_init();
if(curl)
{
curl_easy_setopt(curl, CURLOPT_URL, "https://www.steamcommunity.com");
curl_easy_setopt(curl, CURLOPT_USERPWD, "myusername:mypass");
// Attempt to Connect the Steam Community Server
res = curl_easy_perform(curl);
// Close the connection
curl_easy_cleanup(curl);
}
}