#include <iostream>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#include <cpprest/json.h>
#include <cpprest/uri.h> 

using namespace std;
using namespace web::http::client;
using namespace web::http;
using namespace web::json;

int main(){
    uri base_uri(U("http://188.0.240.110/api/select"));
	http_client client(base_uri);
	web::http::http_request postTestRequest;

	// postTestRequest.set_request_uri(U("api/select"));
	// postTestRequest.set_method(web::http::methods::POST);

	// create post parameters for the body (as json). 
	web::json::value postParameters = web::json::value::object();

	postParameters["op"] = web::json::value::string("send");
	postParameters["uname"] = value::string(U("yourusername"));
	postParameters["pass"] = value::string(U("yourpassword"));
	postParameters["from"] = value::string(U("+98100020400"));
	postParameters["to"] = value::string(U("receptor_number"));
	postParameters["message"] = value::string(U("Hello from C++"));

	postTestRequest.set_body(postParameters);

	http_response response = client.request(methods::POST,"", postParameters.to_string().c_str(), "application/json").get();

    cout << response.body();
}
