### Extracting Numbers with Regex Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/regex This snippet demonstrates how to use a basic Regex pattern to extract all sequences of digits from a given string. The pattern `\d+` matches one or more digit characters. ```regex \d+ ``` -------------------------------- ### JSON Response Processing Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/read-json Examples and explanations on how to process JSON responses, including accessing nested fields and array elements. ```APIDOC ## JSON Response Processing ### Description This section provides guidance on how to extract specific data from JSON responses, including nested objects and arrays. ### Accessing Nested Fields To access a value within a nested JSON object, use dot notation. For example, to get the 'code' from the response above: `$ketQuaCode = $resp.code` To access a nested field like 'date' within 'timestamp': `$ketQuaDate = $resp.timestamp.date` ### Accessing Array Elements When dealing with JSON arrays, use bracket notation with the index (starting from 0) to access specific elements. For example, to get the 'date' of the second user in the 'users' array: `users.[1].timestamp.date` This can also be dynamically accessed using a variable for the index: `$resp.users.[$index].timestamp.date` ``` -------------------------------- ### GET /api/get_code Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/read-json This endpoint retrieves a code based on provided email, password, and type. It returns a JSON object containing user details, status, code, and a timestamp. ```APIDOC ## GET /api/get_code ### Description Retrieves a code associated with an email and password for a specified type (e.g., IMAP). ### Method GET ### Endpoint /api/get_code ### Parameters #### Query Parameters - **mail** (string) - Required - The email address. - **pass** (string) - Required - The password associated with the email. - **type_get** (string) - Required - The type of retrieval (e.g., 'imap'). ### Request Example `GET https://tools.dongvanfb.net/api/get_code?mail=tommiel@hotmail.com&pass=bV1emc&type_get=imap` ### Response #### Success Response (200) - **user** (object) - Contains user's email and password. - **email** (string) - The user's email address. - **password** (string) - The user's password. - **status** (boolean) - Indicates if the request was successful. - **code** (string) - The retrieved code. - **timestamp** (object) - Contains the date and time of the retrieval. - **date** (string) - The date of the retrieval (format: DD/MM/YYYY). - **time** (string) - The time of the retrieval (format: HH:MM). #### Response Example ```json { "user": { "email": "tommiel@hotmail.com", "password": "bV1emc" }, "status": true, "code": "37589", "timestamp": { "date": "15/04/2022", "time": "22:43" } } ``` ``` -------------------------------- ### Split String by '|' in PHP Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/split-text Demonstrates splitting a string by the '|' delimiter in PHP. The input string is 'hello|my|name|is|GPM|Automate', and the output is an array where each element is a segment of the original string. Array indices start from 0. ```php $input_string = "hello|my|name|is|GPM|Automate"; $a = explode('|', $input_string); echo "$a[0] = hello\n"; echo "$a[1] = my\n"; echo "$a[2] = name\n"; echo "$a[3] = is\n"; echo "$a[4] = GPM\n"; echo "$a[5] = Automate\n"; ``` -------------------------------- ### Extract nested 'date' from JSON response Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/read-json Illustrates how to access a value nested within an object in a JSON response. This example shows retrieving the 'date' value, which is located inside the 'timestamp' object. ```php $ketQuaDate = $resp->timestamp->date; ``` -------------------------------- ### Extracting 6-Digit OTP Codes with Regex Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/regex This snippet shows a Regex pattern specifically designed to extract a 6-digit number that is surrounded by word boundaries. This is commonly used for retrieving One-Time Passwords (OTP) from text, such as in emails. The pattern `\b\d{6}\b` ensures that exactly six digits are captured as a distinct word. ```regex \b\d{6}\b ``` -------------------------------- ### Extract 'date' from a specific element in a JSON array Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/read-json Explains how to access a value from an element within a JSON array. This example retrieves the 'date' from the 'timestamp' object of the second user (index 1) in the 'users' array. ```php $ketQuaDate = $resp->users[1]->timestamp->date; ``` -------------------------------- ### HTTP Request Action Source: https://docs.gpmautomate.com/http/http-request This section explains the parameters available for the HTTP Request action and how to configure them for different request types. ```APIDOC ## HTTP Request Action ### Description The HTTP Request action allows you to make various HTTP requests to specified URLs. It supports different HTTP methods, headers, and request bodies, including JSON, form-urlencoded, and multipart/form-data. ### Method GET, POST, PUT, DELETE, etc. ### Endpoint [URL] ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **URL** (string) - Required - The URL of the resource on the server. - **Method** (string) - Required - The HTTP method to use (e.g., GET, POST, PUT, DELETE). - **Header** (object) - Optional - Additional information sent with the request, such as content type and authentication. Example: `{"Authorization": "Bearer "}`. - **Data** (string or object) - Optional - Data to be sent in the request body (applicable for methods like POST and PUT). Format depends on the `Content-Type`. - **Use profile's proxy** (boolean) - Optional - If true, uses the profile's proxy instead of the local IP. ### Request Body Examples #### `application/json` ```json { "key1": "value1", "key2": "value2" } ``` #### `application/x-www-form-urlencoded` ``` key1=value1&key2=value2&key3=value3 ``` #### `multipart/form-data` This format is typically used for file uploads and complex data structures. The configuration will vary based on the specific fields and files being sent. Refer to the UI for detailed field setup. ### Response #### Success Response (200) The response body will vary depending on the API being called. #### Response Example ```json { "status": "success", "data": {} } ``` #### Error Response An error response will be returned if the request fails. The structure will depend on the server's error handling. ```json { "status": "error", "message": "Error description" } ``` ``` -------------------------------- ### Extract 'code' from JSON response Source: https://docs.gpmautomate.com/no-code-automation/text-and-number/read-json Demonstrates how to retrieve the value associated with the 'code' key from a JSON response. It assumes the JSON is stored in a variable and shows direct access to the desired field. ```php $ketQuaCode = $resp->code; ``` -------------------------------- ### Execute JS Code with Variable Embedding Source: https://docs.gpmautomate.com/javascript/execute-js-code Demonstrates how to embed Automate variables into JavaScript code and return a processed value. Ensure string variables are enclosed in backticks or quotes. The code accesses a string variable '$str' and an index '$index' to extract a character, returning it. Handles invalid index cases. ```javascript const str = `$str`; const index = $index; const char = index >= 0 && index < str.length ? str[index] : "Invalid index"; return char; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.