SK_HttpRequest Function

Performs an HTTP request.

Remarks

Important Note

The string returned in the response parameter must be freed from memory! The SK_StringDispose function is recommended for this purpose.

Syntax

C/C++
SK_ResultCode SK_HttpRequest(SK_ApiContext context, int flags, const char *url, const char *postString, char **response, int *statusCode);
Visual Basic
Declare Function SK_HttpRequest(ByVal context As Long, ByVal flags As Long, ByVal url As String, ByVal postString As String, ByRef response As String, ByRef statusCode As Long) As Long

Arguments

context
The API Context handle.
flags
Any flags passed into this function-call.
url
The URL for which the HTTP request will be performed. The value provided must not begin with http:// or https://, as the protocol used is determined by the context's flags or the flags argument.
postString
For HTTP POST, pass the URL-encoded post data string. For HTTP GET, pass NULL or an empty string.
response
Reference/pointer to a string pointer, which will point to the string which contains the response returned from the server when the call succeeds. The string pointer must be initialized to NULL (0) prior to calling this function.
statusCode
Reference/pointer to an integer, which will point to the HTTP response status code for this request.

Returns

All possible return values are included in the SK_ResultCode enumeration. Return codes to expect include:

Result Code Description
SK_ResultCode.SK_ERROR_NONE No error.
SK_ResultCode.SK_ERROR_INVALID_ARGUMENTS Some or all of the arguments are invalid.
SK_ResultCode.SK_ERROR_WEBSERVICE_CALL_FAILED An unexpected failure occurred during an attempt to call a Web Service.
SK_ResultCode.SK_ERROR_HTTP_INITIALIZATION_FAILED The HTTP client failed to initialize.
SK_ResultCode.SK_ERROR_HTTP_CONNECTION_FAILED The server could not be reached. Verify that the computer is connected to the Internet, and that the firewall/proxy is set-up properly.
SK_ResultCode.SK_ERROR_HTTP_COULD_NOT_RESOLVE_HOST The server could not be located. Verify that the computer is connected to the Internet, and that the firewall/proxy is set-up properly.
SK_ResultCode.SK_ERROR_SSL_FAILED The HTTPS request failed due to an SSL related error.
SK_ResultCode.SK_ERROR_SSL_CERTIFICATE_UNAVAILABLE The client certificate for SSL communication could not be found.