Exemplo n.º 1
0
unsigned int ApiClient::post(const char *url, const char *data)
{
	request_buffer = F("curl -X POST ");
	request_buffer += F("-H \"Authorization: ");
	addAuthorizationHeader();
	request_buffer += F("\" ");
	request_buffer += F("-H \"Content-Type: ");
	addContentTypeHeader();
	request_buffer += F("\" ");
	request_buffer += F("-d '");
	request_buffer += data;
	request_buffer += F("' ");
	request_buffer += url;
	return request();
}
Exemplo n.º 2
0
static void
createCurlHeaderList(xmlrpc_env *               const envP,
                     const char *               const authHdrValue,
                     const char *               const userAgent,
                     struct curl_slist **       const headerListP) {

    struct curl_slist * headerList;

    headerList = NULL;  /* initial value - empty list */

    addContentTypeHeader(envP, &headerList);
    if (!envP->fault_occurred) {
        addUserAgentHeader(envP, &headerList, userAgent);
        if (!envP->fault_occurred) {
            if (authHdrValue)
                addAuthorizationHeader(envP, &headerList, authHdrValue);
        }
    }
    if (envP->fault_occurred)
        curl_slist_free_all(headerList);
    else
        *headerListP = headerList;
}