Hi All,

I have set the cookie into HTTP header in this way.

    .....
    CURL *curl;
    CURLcode res;

    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "Accept:
application/x-www-form-urlencoded");
    headers = curl_slist_append(headers, "Content-Type:
application/x-www-form-urlencoded");
    headers = curl_slist_append(headers, "charsets: utf-8");

    curl_global_init(CURL_GLOBAL_ALL);
    curl = curl_easy_init();
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
    curl_easy_setopt(curl,CURLOPT_HTTPHEADER,headers);
    curl_easy_setopt(curl, CURLOPT_URL,"
http://localhost:9763/store/site/blocks/subscription/subscription-add/ajax
/subscription-add.jag");
    curl_easy_setopt(curl, CURLOPT_POST, 1);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS,reqbody);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, body_callback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data);
    curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
    curl_easy_setopt(curl, CURLOPT_HEADERDATA,&cookieGet);
    curl_easy_setopt(curl, CURLOPT_COOKIE,cookie);
    res=curl_easy_perform(curl);
    ......

In server side when I retrieved post data they seem to be null. But when I
check from Wireshark actually those post data are sent. But when I remove

    curl_easy_setopt(curl, CURLOPT_COOKIE,cookie);

I can access the post data in the server side. If I make any mistake in my
post request please correct me.

Thanks,


Geesara Prathap Kulathunga,
Software Engineering Intern,
University of Peradeniya.
[email protected] <Email:[email protected]>
+940772684174


On Tue, Jan 6, 2015 at 3:43 PM, Geesara Prathap <[email protected]> wrote:

> Hi,
>
> There is a Node server which acts as a hub  among devices,clients  and
> WSO2 API Manager.
>
> As of now the Client is able to,
>
>    1. sign up
>    2. login
>    3. add  applications
>    4. subscribe to applications
>    5. get the access token from API Manager
>
>  through Node server.
>
> When adding an application, client is able to configure how devices are
> arranged and that configuration file should be sent to the node server with
> a client request. Then Node server reads that file and generates a REST API
> with respect to the relevant client.
>
>
>
> I did the first part of this implementation. Now a client can do all those
> operations which were  mentioned above except REST API generation part.
> Here is the code repository[1]  what I did so far.
>
> [1] https://github.com/GPrathap/wso2nodeserver
>
>
>
> Thanks
>
>
>
>
>
>
>
> Geesara Prathap Kulathunga
> Software Engineer Intern
> University of Peradeniya
> [email protected] <Email:[email protected]>
> +940772684174
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to