I'm working on an application and I'm trying to "license" it by sending an API key with application versioning to my website and get the return value of the webpage.
User opens application --> Application sends a GET request with 2 values to the webserver: ?authkey=[key]&v=1.00
--> grab the return value
I have tried to work on this but it always seems to fail on me. This is where I'm currently at:
char buffer[1024] =
"GET / HTTP/1.1\r\n"
"Host: example.com\r\n"
"Accept-Language: en-US,en;q=0.5\r\n"
"User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0\r\n"
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
"Connection: keep-alive\r\n"
"Cache-Control: max-age=0\r\n\r\n";
size_t buffer_len = sizeof(buffer) - 1;
n = write(sockfd, buffer, buffer_len);
bzero(buffer, strlen(buffer));
n = read(sockfd, buffer, buffer_len);
printf("%s\n",buffer);
sysNotify(buffer);
// if(buffer == "valid") // continue?
But I have no idea how to send the GET request, and how to compare the return value afterwards.
If anybody would like to assist me with this, that would be amazingly appreciated.