Skip to content
it4e edited this page Dec 12, 2016 · 3 revisions

Name

<chl/chl.h>

chl_set_cookie, CHL set cookie

Declaration

void chl_set_cookie(char * name, char * value, char * expires);

Description

The chl_set_cookie function is used to set the cookie [name] with the value [value].

Arguments

  • name: the name of the cookie.
  • value: the value of the cookie.
  • expires: lifetime of cookie in format: Wdy, DD-Mon-YYYY HH:MM:SS GMT. Set this to NULL for session.

Return value

No return value.


Examples

main.c

#include <chl/chl.h>
#include <stdio.h>

int main() {
    chl_set_cookie("name", "Olof", NULL);
    chl_print_headers();

    char * value;

    if((value = chl_cookies("name")))
        fputs(value, stdout);
}

Output: Olof

As CHL is open-source, people are able to contribute with their own APIs, plugins and code which means that CHL is constantly upgraded and provided with new features. Do you have an idea for a new CHL feature and want to contribute?

See contribute.

Setup. API. Tutorial. Examples. FastCGI.

Clone this wiki locally