Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8067225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:13:21+00:00 2026-06-05T12:13:21+00:00

i have a code to get source of html file but it get also

  • 0

i have a code to get source of html file but it get also “header response” or sth. like that (i don’t know how to call it) how can i get it without this header?

my code:

#include "StdAfx.h"
#include <iostream>
#include <boost/array.hpp>
#include <boost/asio.hpp>

using boost::asio::ip::tcp;

std::size_t completion(const boost::system::error_code& error, std::size_t bytes_transfered)
{
    return ! error;
}

int main(int argc, char* argv[])
{
    boost::asio::io_service io_service;
    boost::asio::ip::address addr = boost::asio::ip::address::from_string("31.170.161.16");
    boost::asio::ip::tcp::endpoint endpoint(addr, 80);
    tcp::socket socket(io_service);
    socket.connect(endpoint);
    boost::asio::streambuf request;
    std::ostream requestStream(&request);
    requestStream << "GET /xD1azt4_panel/bhc.html HTTP/1.1\r\n"
                  << "Connection: Keep-Alive\r\n"
                  << "Host: dublersoft.hostoi.com\r\n\r\n";

    boost::asio::write(socket, request);
    boost::asio::streambuf respond;
    boost::system::error_code ec;
    boost::asio::read(socket, respond, completion, ec);
    std::cout << &respond << std::endl;
    getchar();
    return 0;
}

and result:
result

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:13:22+00:00Added an answer on June 5, 2026 at 12:13 pm

    It’s surprised that I also use this as my simple http client, So I just share my method, headers are put in a vector if you need it later, response data put in ostream object.

    int do_get(std::string &host_,std::string &port_, std::string url_path,std::ostream &out_,std::vector<std::string> &headers, unsigned int timeout)
    {
        try{
            using namespace boost::asio::ip;
            tcp::iostream request_stream;
            if (timeout>0){
                request_stream.expires_from_now(boost::posix_time::milliseconds(timeout));
            }
            request_stream.connect(host_,port_);
            if(!request_stream){
                return -1;
            }
            request_stream << "GET " << url_path << " HTTP/1.0\r\n";
            request_stream << "Host: " << host_ << "\r\n";
            request_stream << "Accept: */*\r\n";
            request_stream << "Cache-Control: no-cache\r\n";
            request_stream << "Connection: close\r\n\r\n";
            request_stream.flush();
            std::string line1;
            std::getline(request_stream,line1);
            if (!request_stream)
            {
                return -2;
            }
            std::stringstream response_stream(line1);
            std::string http_version;
            response_stream >> http_version;
            unsigned int status_code;
            response_stream >> status_code;
            std::string status_message;
            std::getline(response_stream,status_message);
            if (!response_stream||http_version.substr(0,5)!="HTTP/")
            {
                return -1;
            }
            if (status_code!=200)
            {
                return (int)status_code;
            }
            std::string header;
            while (std::getline(request_stream, header) && header != "\r")
                headers.push_back(header);
            out_ << request_stream.rdbuf();
            return status_code;
        }catch(std::exception &e){
            std::cout << e.what() << std::endl;
            return -3;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some source code to get the file name of an url for
I have an app that I need to get the source code to update
When I wanted to get Android source code, I knew that I have to
How can I get html source code from an external web page? Something like:
I have the following code in my .html.erb file that work just as expected:
I have written simple code to get content from xml file to php. $xml
I have code like function populate...() { var user = $.storage.get(particulars); if (user) {
I found this file mappanslow.html last week on http://code.google.com/p/gmaps-samples-v3/source/browse/trunk/talks/io2011/map-usability/mappanslow.html?spec=svn265&r=265 and it was very useful
I have the following code: // GET: /PlayRoundHole/Create public ActionResult Create(int id) { DB
i have this code to get the search resutls from the api: querygoogle.php: <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.