SK_HttpRequest Function

Performs an HTTP request.


Important Note

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


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


The API Context handle.
Any flags passed into this function-call.
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.
For HTTP POST, pass the URL-encoded post data string. For HTTP GET, pass NULL or an empty string.
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.
Reference/pointer to an integer, which will point to the HTTP response status code for this request.


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.