Reading data from a web server

I want my program to open a new TCP connection to my web server and pull some "#define" lines from it. How could I go about doing this?
If you want to get a file from a HTTP server, cURL is the easiest way.
If not, you can use sockets (using Boost.Asio, for example).

Also, you say you want to pull #define lines. I'm not sure what for, but you should realize you cannot change the program behavior via defines after the program has been compiled.
I don't want to get a file and I don't necessarily want to load a define. I made a program and I'm trying to keep it secure from leaking. I want the program to load specific variables from my website so that, for example, if I took my site down then the program would no longer work.
Last edited on
Ah, alright. However, someone could still get the program to work by providing the necessary data on a local server.
Yes, I completely understand that but that doesn't quite answer my question. I am trying to figure out how to load variables directly from a web server. I don't even know how to Google this because I'm not entirely sure what it is called (if it has a specific name.) Could you point me in the right direction please?

I am thinking of doing something along these lines..
-Create an SQL database
-Load the variables I want into the SQL database
-Have my program connect to the SQL database
-Have my program load variables form the SQL database

Example..
1
2
3
4
5
6
7
int main()
{
	SQL.Connect("127.0.0.1", "User", "Pass", "Database");
	unsigned long Variable = SQL.Get("Table", "Variable");

	return 0;
}
Last edited on
I already answered your question in the first reply.
Using a database server might be a bit of overkill, but it would work using mysql++ or similar.

Edit:
I am trying to figure out how to load variables directly from a web server.

You can just have all the variables in a file and serve it using a HTTP server.
Alternatively, you can write a server that uses some protocol of your own creation or one that just dumps the variables into the stream upon a client connecting. See Boost.Asio for that.
Last edited on
Topic archived. No new replies allowed.