Function __global->cms_fsock_request
Definitions
sources/global3.php
- Make a low-level fsockopen request to an API.Ideally, you should use a secure endpoint and encrypt the data to be sent using encrypt_message().
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $payload | string | No | No | required parameter | N/A | N/A | The payload to send as a JSON-encoded string (blank: make a GET request) |
| $url | URLPATH | No | No | required parameter | N/A | N/A | The URL to call including the path and port |
| &$error_code | ?integer | Yes | No | Null | N/A | N/A | The error code returned (passed by reference) (null: No error) |
| &$error_message | string | Yes | No | Blank (empty string) | N/A | N/A | The error message returned (passed by reference) (blank: No error) |
| $timeout | float | No | No | 6 | N/A | N/A | The timeout in seconds |
Returns
- response from the fsock (null: error)
- Type: ?string
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Make a low-level fsockopen request to an API.Ideally, you should use a secure endpoint and encrypt the data to be sent using encrypt_message().
*
* @param string $payload The payload to send as a JSON-encoded string (blank: make a GET request)
* @param URLPATH $url The URL to call including the path and port
* @param ?integer $error_code The error code returned (passed by reference) (null: No error)
* @param string $error_message The error message returned (passed by reference) (blank: No error)
* @param float $timeout The timeout in seconds
* @return ?string response from the fsock (null: error)
*/
function cms_fsock_request(string $payload, string $url, ?int &$error_code = null, string &$error_message = '', float $timeout = 6) : ?string
* Make a low-level fsockopen request to an API.Ideally, you should use a secure endpoint and encrypt the data to be sent using encrypt_message().
*
* @param string $payload The payload to send as a JSON-encoded string (blank: make a GET request)
* @param URLPATH $url The URL to call including the path and port
* @param ?integer $error_code The error code returned (passed by reference) (null: No error)
* @param string $error_message The error message returned (passed by reference) (blank: No error)
* @param float $timeout The timeout in seconds
* @return ?string response from the fsock (null: error)
*/
function cms_fsock_request(string $payload, string $url, ?int &$error_code = null, string &$error_message = '', float $timeout = 6) : ?string

