ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 5133

Get HTML Code of a Website with C++!?

by supdawgfam - 08-06-2016 - 06:31 PM
#1
Hey, does anybody know how to achiev this!?
This could be used for authing if you would want to read of a raw paste on fe. Pastebin.com, so i'm sure i'm not the only one who could use that code! Thanks in advance Guys!
Reply
#2
ive got a jtag contact me and ill test it
Reply
#3
You can use curl or another HTTP library to achieve this. And, why use C++? You can use python simply with requests library.
Reply
#4
You don't even need an HTTP library. Just connect via TCP and read the stream of data from the socket until you've read \r\n\r\n which marks the end of the header, then parse the header and content length and read that number of bytes... If they force HTTPS then you'll need SSL.
Reply
#5
Your best bet is probably this. It's a library for C which can easily be used for your code.
Reply
#6
Yeah as @IcyJake said, use curl. Since I'm a new member ill share with you some snippets my code


Code:
std::string Engine::GetString(std::string url)
{
CURL *curl;
CURLcode res;
std::string readBuffer;

curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}

return readBuffer;
}


then just call it in your function like:


Code:
engine.GetString("http://yoursite.com/index.htmll");
Reply

Users browsing: 2 Guest(s)