I haven't tested your code, but I use this (it was originally from somebody else on this forum actually, I just adapted it. Not trying to steal any credit here:P):
void DownloadFile(const std::string& Host, const std::string& RemoteFile, const std::string& LocalFile, unsigned short Port = 0)
{
sf::Http Http;
sf::Http::Request Request;
unsigned int FileSize = 0;
Http.setHost(Host,Port);
Request.setMethod(sf::Http::Request::Get);
Request.setUri(RemoteFile);
sf::Http::Response Page = Http.sendRequest(Request);//Get the data
FileSize = Page.getBody().size();//Get the size that was returned
std::string FileContainer = Page.getBody();
std::ofstream File(LocalFile.c_str(), std::ios::out | std::ios::binary);
File.write(FileContainer.c_str(), FileSize);//Write the file
File.close();
}
As you can see my function saves the file to the local drive, however you can modify it to return the string rather than writing the string to the file.