[OpenR8 solution] CGI (The interface program allows your web page to communicate with the www server to achieve interaction with the user)
  1. Chapter1: CGI Introduction

 

CGI is a technology for network communication. It requests data from the web browser through a web browser, and after making a specific CGI program, it is displayed back on the browser, as shown in Fig. 1.

 

Fig. 1. Process.png

Fig. 1. Process.

 

※ To execute a CGI program, you will need to install apache. Please install and set the relevant path and parameters.

 

 

  1. Chapter2: CGI folder introduction

 

CGI is in the solution folder of OpenR8, as shown in Fig. 2, with seven flow files and five html, as shown in Fig. 3. The functions of the seven solutions are described in Chapters 3~9.

※CURL_GetPostFile.flow and CURL_GetPostFile.html are not covered in this CGI introduction, please see the CURL file.

 

Fig. 2. CGI location.png

Fig. 2. CGI location.

 

Fig. 3. CGI folder.png

Fig. 3. CGI folder.

 

 

  1. Chapter3: CGI_GetEnvString.flow — Get the specified environment variable

 

Please click “File” => “Open” => “Enter the solution folder under OpenR8” => “Select CGI folder” => “Load CGI_GetEnvString.flow”, as shown in Fig. 4, Fig. 5.

 

Fig. 4. Select CGI_GetEnvString.flow.png

Fig. 4. Select CGI_GetEnvString.flow.

 

Fig. 5. Open CGI_GetEnvString.flow.png

Fig. 5. Open CGI_GetEnvString.flow.

 

Select the environment variable you want to get. Take CGI_GetEnvString.flow as an example. If you want to get the content of SERVER_NAME, fill in SERVER_NAME, as shown in Fig. 6.

 

※If you just want to see the result, you can skip the setting.

 

Fig. 6. Fill in the name of the environment variable you want to get.png

Fig. 6. Fill in the name of the environment variable you want to get.

 

 Then open the browser and enter http://localhost/CGI_GetEnvString.html in the URL to go to the web page, as shown in Fig. 7.

 

Fig. 7. Open CGI_GetEnvString.html.png

Fig. 7. Open CGI_GetEnvString.html.

 

After pressing Submit, you will see the result of returning SERVER_NAME, as shown in Fig. 8.

 

Fig. 8. Get SERVER_NAME.png

Fig. 8. Get SERVER_NAME.

 

 

  1. Chapter4: CGI_GetGetString.flow — Get string value

 

Please click “File” => “Open” => “Enter the solution folder under OpenR8” => “Select CGI folder” => “Load CGI_GetGetString.flow”, as shown in Fig. 9, Fig. 10.

 

Fig. 9. Select CGI_GetGetString.flow.png

Fig. 9. Select CGI_GetGetString.flow.

 

Fig. 10. Open CGI_GetGetString.flow.png

Fig. 10. Open CGI_GetGetString.flow.

 

Since CGI_GetGetString.html will call CGI_GetGetString.flow, the contents of the test page will be modified in conjunction with the CGI_GetGetString.flow field. Right click on CGI_GetGetString.html and open it with Notepad or notepad++ to change the value of Fig. 11 to the value of Fig. 12.

 

Fig. 11. CGI_GetGetString.flow.png

Fig. 11. CGI_GetGetString.flow.

 

Fig. 12. CGI_GetGetString.flow.png

Fig. 12. CGI_GetGetString.flow.

 

Then open the browser, enter http://localhost/CGI_GetGetString.html in the URL, and go to the web page, as shown in Fig. 13.

 

Fig. 13. Open CGI_GetGetString.html.png

Fig. 13. Open CGI_GetGetString.html.

 

After pressing Submit, you can see the result of sending the string, as shown in Fig. 14.

 

Fig. 14. Get String value.png

Fig. 14. Get String value.

 

 

  1. Chapter5: CGI_GetPostFile.flow — Get Post file

 

Please click “File” => “Open” => “Enter the solution folder under OpenR8” => “Select CGI folder” => “Load CGI_ GetPostFile.flow”, as shown in Fig. 15, Fig. 16.

 

Fig. 15. Select CGI_GetPostFile.flow.png

Fig. 15. Select CGI_GetPostFile.flow.

 

Fig. 16. Load CGI_GetPostFile.flow.png

Fig. 16. Load CGI_GetPostFile.flow.

 

Then open the browser and enter http://localhost/CGI_GetPostFile.html at the URL to go to the web page, as shown in Fig. 17.

 

Fig. 17. Open CGI_GetPostString.html.png

Fig. 17. Open CGI_GetPostString.html.

 

After selecting the file in the file1 and file2 fields, press Submit, you can see the two binary files "saveBinary.bin" and "saveBinary2.bin" in the CGI folder, as shown in Fig. 18.

 

Fig. 18. Open CGI_GetPostString.flow.png

Fig. 18. Open CGI_GetPostString.flow.

 

 

  1. Chapter6: CGI_GetPostString.flow — Get Post string

 

Please click “File” => “Open” => “Enter the solution folder under OpenR8” => “Select CGI folder” => “Load CGI_GetPostString.flow”, as shown in Fig. 19, Fig. 20.

 

Fig. 19. Select CGI_GetPostString.flow.png

Fig. 19. Select CGI_GetPostString.flow.

 

Fig. 20. Load CGI_GetPostString.flow.png

Fig. 20. Load CGI_GetPostString.flow.

 

Then open the browser and enter http://localhost/CGI_GetPostString.html at the URL to go to the web page, as shown in Fig. 21.

 

Fig. 21. Open CGI_GetPostString.html.png

Fig. 21. Open CGI_GetPostString.html.

 

After selecting the file in the file1 and file2 fields, press “Submit” and the post-to-string content will be printed, as shown in Fig. 22.

 

Fig. 22. Show Post string.png

Fig. 22. Show Post string.

 

 

  1. Chapter7: CGI_ParseRequest.flow — Obtaining environmental variables

 

Please click “File” => “Open” => “Enter the solution folder under OpenR8” => “Select CGI folder” => “Load CGI_ParseRequest.flow”, as shown in Fig. 23, Fig. 24.

 

Fig. 23. Select CGI_ParseRequest.flow.png

Fig. 23. Select CGI_ParseRequest.flow.

 

Fig. 24. Load CGI_ParseRequest.flow.png

Fig. 24. Load CGI_ParseRequest.flow.

 

 

  1. Chapter8: CGI_PrintBinary.flow — Print binary file

 

Please click “File” => “Open” => “Enter the solution folder under OpenR8” => “Select CGI folder” => “Load CGI_PrintBinary.flow”, as shown in Fig. 25, Fig. 26.

 

Fig. 25. Select CGI_PrintBinary.flow.png

Fig. 25. Select CGI_PrintBinary.flow.

 

Fig. 26. Open CGI_PrintBinary.flow.png

Fig. 26. Open CGI_PrintBinary.flow.

 

Then open the browser and enter http://localhost/CGI_PrintBinary.html in the URL to go to the web page, as shown in Fig. 27.

 

Fig. 27. Open CGI_PrintBinary.html.png

Fig. 27. Open CGI_PrintBinary.html.

 

After selecting the file in the file1 field, press Submit to print out the binary content of the post, as shown in Fig. 28

 

Fig. 28. Show Post binary.png

Fig. 28. Show Post binary.

 

  1. Chapter9: CGI_PrintInfo.flow — Print all environment variable content

 

Please click “File” => “Open” => “Enter the solution folder under OpenR8” => “Select CGI folder” => “Load CGI_PrintInfo.flow”, as shown in Fig. 29, Fig. 30.

 

Fig. 29. Select CGI_PrintInfo.flow.png

Fig. 29. Select CGI_PrintInfo.flow.

 

Fig. 30. Open CGI_PrintInfo.flow.png

Fig. 30. Open CGI_PrintInfo.flow.

 

If executed directly, the environment variables in the computer will be printed, as shown in Fig. 31; if executed through the web page, the environment variables of the web page will be printed, as shown in Fig. 32.

 

Fig. 31. Print computer environment variables.png

Fig. 31. Print computer environment variables.

 

Fig. 32. Print web environment variables.png

Fig. 32. Print web environment variables.

Tag:

Recommended Article

1.
OpenR8 - AI Software for Everyone (Download)