Untitled
unknown
plain_text
2 years ago
1.3 kB
6
Indexable
#include <iostream> #include <curl/curl.h> int main() { CURL* curl; CURLcode res; curl_global_init(CURL_GLOBAL_DEFAULT); curl = curl_easy_init(); if (curl) { // Webhook URL'sini belirtin const char* webhookUrl = "<webhook_url>"; // Dosya yolu const char* filePath = "/path/to/file.txt"; // Dosya gönderme işlemi için multipart/form-data olarak ayarlayın struct curl_httppost* formpost = nullptr; struct curl_httppost* lastptr = nullptr; curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "file", CURLFORM_FILE, filePath, CURLFORM_END); // CURL yapılandırması curl_easy_setopt(curl, CURLOPT_URL, webhookUrl); curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); // İsteği gönderin res = curl_easy_perform(curl); if (res != CURLE_OK) std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl; // CURL örneğini temizleyin curl_easy_cleanup(curl); // form verilerini temizleyin curl_formfree(formpost); } curl_global_cleanup(); return 0; } // https://discord.com/api/webhooks/1109904831285567519/bCv9MwMEUM8_E0f9SZLjBhHCbcNAzZ8eK28MmIX2J9LB7meXdsr3ReTX9JsWfOxQdb-i
Editor is loading...