-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPastebin.cpp
46 lines (35 loc) · 950 Bytes
/
Pastebin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "stdafx.h"
#include "Pastebin.h"
Pastebin::Pastebin()
{
this->m_Address = "www.pastebin.com";
this->m_Port = 80;
this->m_Target = "/api/api_post.php";
this->m_ContentType = "application/x-www-form-urlencoded; charset=utf-8";
this->m_PostData = "api_dev_key=" + std::string(PASTEBIN_API_KEY);
this->m_PostData += "&api_option=paste&api_paste_private=1";
//&api_user_key=
}
std::string Pastebin::Upload(std::string title, std::string content)
{
std::stringstream upload_text;
upload_text << "&api_paste_name=" << title;
upload_text << "&api_paste_code=" << UrlEncode(content);
/*
/ Final m_Packet assembling.
*/
this->m_PostData += upload_text.str();
std::string link = HttpClient::Upload();
return link;
}
std::string Pastebin::Upload(std::string fileName)
{
return this->Upload(fileName, LoadFileFromDisk(fileName));
}
std::string Pastebin::ParseResult(char *Buffer)
{
return Buffer;
}
Pastebin::~Pastebin()
{
}