Here is a simple code to make an HTTP call with the CURL library.
The call is also passing 2 parameters and the line will looks like:
http://somewebsite.com/web_server.php?param1=12345&param2=67890

This is also requires the installation of the curl library. Download the latest version from HERE. The home page of CURL is HERE.
Unzip it in a folder then:

sudo ./configure
sudo make
sudo make install

Here is the c++ code in a function:

#include  <string.h>
#include <curl/curl.h>

using namespace std;

void send_log_http(string sparam1, string sparam2)
{
  CURL *curl_main;
  CURLcode res;
  string sparams=””;
  sparams.append(“param1=”);
  sparams.append(sparam1);
  sparams.append(“&param2=”);
  sparams.append(sparam2);

  curl_global_init(CURL_GLOBAL_ALL);
  curl_main = curl_easy_init();
  if(curl_main)
  {
    curl_easy_setopt(curl_main, CURLOPT_URL, “http://somewebsite.com/web_server.php”);

    curl_easy_setopt(curl_main, CURLOPT_POSTFIELDS, sparams.c_str());
    curl_easy_setopt(curl_main, CURLOPT_WRITEFUNCTION, NULL);

    res = curl_easy_perform(curl_main);
    if (res != CURLE_OK)
    {
      char buf[250];
      sprintf(buf, “[curl_main]-%s”, curl_easy_strerror(res));
    }
    curl_easy_cleanup(curl_main);
  }
  else
  {
    char buf[250];
    sprintf(buf, “Error creating curl_main.”);
  }
  curl_global_cleanup();
}

 

The web_server.php must start like that:

 

<?php
………..
if (isset($_REQUEST[‘param1’]) && isset($_REQUEST[‘param2’]))
{
  $param1 = $_REQUEST[‘param1’];
  $param2 = $_REQUEST[‘param2’];
…….

}

?>