[OpenR8 solution] CURL (Use the CURL library to get external pages)
  1. CURL Introduction

 

CURL is a function library of network communication. Use the URL syntax command to get the results you want, such as transferring a string, receiving data, downloading files, and so on.

 

The CURL solution in openR8 describes how to get content sent from a Web page through the CURL command.

 

※ The implementation of CURL program will need to install Apache, please install and set the relevant path, parameters. You can refer to the way the py file is executed on the website and change the. py to. Flow.

 

※ because the Curl.flow will call the Curl_getpostfile.flow file in the CGI folder, the environment parameters please set the CGI folder. 

 

 

  1. CURL Folder Introduction

 

CURL is located in the solution folder of OpenR8. There is a curl.flow file in Fig. 1, Fig. 2.

 

※Solution > CGI > Curl_getpostfile.flow and curl_getpostfile.html are in the context of this CURL introduction.

 

Fig. 1. The path of CURL..png

Fig. 1. The path of CURL.

 

Fig. 2. CURL folder. .jpg

Fig. 2. CURL folder.

 

 

  1. Receive data through CURL_GetPostFile.flow

 

Please click "File" => “Open” => “Go to the solution folder under OpenR8” => “Select CURL folder” => “Open CURL.flow”. See Fig. 3, Fig. 4.

 

Fig. 3. Select the CURL.flow..png

Fig. 3. Select the CURL.flow.

 

Fig. 4. Open the CURL.flow..jpg

Fig. 4. Open the CURL.flow.

 

Change the URL field of the original "Curl_ settings" from Http://localhost//CURL_GetPostFile.r6 to Http://localhost//CURL_GetPostFile.flow, as shown in Fig. 5.

 

※Because you will use the Curl_getpostfile.flow file in the CGI folder, first make sure that the environment parameters are located in the CGI folder.

 

Fig. 5. Change the URL of a call..png

Fig. 5. Change the URL of a call.

 

Press execute to receive the files transmitted through curl and store the binary file in the CURL folder.

 

Fig. 6. Store the folder path to receive files through Curl..jpg

Fig. 6. Store the folder path to receive files through Curl.

 

 

  1. CURL_GetPostFile.flow — Receive Curl.flow's Files

 

Please click "File" => "open" => "enter the solution folder under OpenR8" => "Select CGI folder" => "Select and open Curl_getpostfile.flow", as shown in Fig. 7, Fig. 8.

 

※This solution is located in the CGI folder. Please open this flow in the CGI folder.

 

擷取.png

Fig. 7. Select the CURL_GetPostFile.flow.

 

Fig. 8. Open the CURL_GetPostFile.flow..jpg

Fig. 8. Open the CURL_GetPostFile.flow.

 

Use CURL.flow to transfer to http://localhost/CURL_GetPostFile.flow. Use Curl_getpostfile.flow to save a new file with the binary file with the transfer name File1, as shown in Fig. 9.

 

Fig. 9..png

Fig. 9. Save File1 's contents as a Savebinary.bin file.

 

 

  1. CURL Function Introduction

 

  1. 【CURL_Init】 : Curl initialization.

CURL (Object) : Create a Curl Object.

  1. 【CURL_Set】 : Sets the URL to transfer, the maximum number of seconds (termination time) of the page transfer time.

CURL (Object) : Enter an object for "Curl_init".

url : Sets the URL to transfer.

Termination time : Sets the time of the timeout, and if no termination time is set, the default is 10 seconds. 

  1. 【CURL_FormAddString】 : The name and content of the transmitted string ("CURL_Set" needs to be set first).

curl(Object) : Enter an object for "Curl_init".

Name : Enter a string name for the transfer.

String : Enter the contents of the transmitted string.

  1. 【CURL_FormAddBinary】 : The transferred domain name, the transmitted binary file name, the content (the "curl_set" needs to be set first).

curl(Object) : Enter an object for "Curl_init".

name:Enter a name for the transfer.

fileName:Enter the binary file name for the transfer.

binary : Enter the binary content of the transfer.

  1. 【CURL_Perform】 : Transfer the CURL command to send the string and binary file you want to transfer to the URL of the "Curl_Set" setting.

curl(Object) : Enter an object for "Curl_init".

string : Enter the name of the string to transfer.

binary : Enter the binary file name for the transfer.

 

 

Tag:

Recommended Article

1.
OpenR8 Community Edition - AI Software for Everyone (Free Download)