How to use a cgi function ?


I’m a french student on programming school and I’m training at the moment in a small company where I’m programming on Dynamic C language (Dynamic C Dist 9.62 version). I’m a begginer in this language.

I must create a HTTP server with a rabbit 3365.

Currently, I succed to read Dynamic C variables in HTML document with #web in dynamic C code and in html code.

I would like to trigger a Dynamic C function from the web page. Therefore I read pdf documentation about tcp/ip in rabbit but I don’t found what I search.

I tried cgi function like this:

  • in dynamic C code I created a cgi function with HttpState* as an input and I included it in SSPEC_RESOURCETABLE_START .
  • in HTML code succed to trigger this function from a link like this: text.

This works, I can trigger the cgi function (just printf() at the moment) from this link but the web browser redirect me on “x.x.x.x/cgiFunctionName” (normal for a link). Therefore I can’t do any other action after the cgi function triggering.

I would like to have a solution to trigger the same cgi function but from a button (or a link) without redirection.
If there is an other solution (without cgi), I also take it !

Thank you in advance for people who help me !

Hello Edvin,

Under Dynamic C 9.62, there are some examples related to web server at the below path
C:\DCRABBIT_9.62\Samples cpip\rabbitweb

Go through those apps. It may help you.

And also check below document

Thank you cpigilam,

It’s works with cgi_redirectto(state,REDIRECTTO) =)