Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    CGIParse 0.0.1

    Download button

    No screenshots available
    Downloads: 1,013  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Rasmus Toftdahl Olesen | More programs
    GPL / FREE
    February 23rd, 2007, 16:42 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    CGIParse description

    CGIParse project is a C class library for parsing the input of a cgi program.

    CGIParse project is a C class library for parsing the input of a cgi program.

    Starting

    To start using CGIParse you first have to include the cgiparse.h header:

    #include < cgiparse.h >

    Thereafter you have to define the CGIParse object:
    CGIParse cgi;

    The CGIParse object then automatically reads the headers and the variables parsed to the program using environment variables and (if using POST or PUT) standard input.

    Now the library has been initialized and we are ready to use it.

    Header

    The headers parsed to CGIParse is easily available to the programmer after the library has been initialized. To retrieve them CGIParse provides functions named after the environment variable it retrieves. Fx. to retrieve the SERVER_SOFTWARE environment variable, you use the function server_software(). The functions providing these environment variables are:

    char* server_software(void);
    char* server_name(void);
    char* gateway_interface(void);
    char* server_protocol(void);
    int server_port(void);
    int request_method(void);
    char* request_methodc(void);
    char* path_info(void);
    char* path_translated(void);
    char* script_name(void);
    char* query_string(void);
    char* remote_host(void);
    char* remote_addr(void);
    char* auth_type(void);
    char* remote_user(void);
    char* remote_ident(void);
    char* content_type(void);
    int content_length(void);
    char* http_accept(void);
    char* http_user_agent(void);
    char* http_referer(void);
    char* input(void);

    It is important to note that if the environment variable you are trying to access doesn't exist, the function will return NULL if you were trying to retrieve a char* and -1 if it's a int.

    Variables

    The variables from the browser can of course also be accessed by CGIParse.

    To retrieve the number of variables, you can use the int num() function, and to retrieve the variable names and parameters number i, you user the functions:

    char* name ( int i );
    char* parm ( int i );

    You can also use the function char* parm ( const char *n ); to retrieve the parameter of the variable with name n.

    Debugging

    When debugging your CGI application it can sometimes be useful to see what is transfered to the CGI application. You could of course program this yourself, but for your ease some functions for it has been provided the function htable() draws a html table with the header retrieved from CGI.

    CGIParse also provide you with a function called ptable() which prints the variables sent to the CGI application.

    Product's homepage

      


    TAGS:

    C class | parsing cgi input | cgi library | CGIParse | C | class

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM