On Ubuntu, you can do it using a system call to WGET.
Some thing like :

Code: CPP
#include <iosteam>
#include <cstdlib>
#include <fstream>
#include <string>

using namespace std;

int main()
{
    string line;

    if(system("wget www.google.com")==0)
    {
        cout << "ok\n";
        ifstream file ("index.html");
        while (!myfile.eof())
        {
            getline(file,line);
            cout<<line<<"\n";
        }
        file.close();
    }
    else
        cout << "NOT ok\n";
    return 0;
}