AMXX-BG.INFO httpx.inc Functions

httpx functions

All callable symbols documented in this include, grouped by declaration type.

Natives

Name Signature
HTTPX_Abort native HTTPX_Abort(DownloadID, bool:DeleteFile = true) /** * HTTPX_AddPostVar(const variable[], const value[]) * * Adds a POST variable to the request. * This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. * It can be used multiple times before each download. **/ native HTTPX_AddPostVar(const variable[], const value[]) /** * HTTPX_AddPostRaw(const data[]) * * Adds raw POST data to the request. * This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. * It can be used multiple times before each download. **/ native HTTPX_AddPostRaw(const data[]) /** * Number of parameters for the callbacks are 1 (DownloadID) for the progress event and 2 (DownloadID, Error) for the complete event. * Error codes: * 0 Download done. No problems encountered. * Positive returns is unhandled HTTP return codes. For example 404. * Negative is internal errors. * -1 No response code was found in the HTTP response header or it was outside the accepted range (200-307). * -2 Server is sending bad data or sizes for a chunked transfer or HTTPX has problems reading them. * -3 Nothing received in last packet. Most likely due to an error. * -4 HTTPX was redirected but could not follow due to a socket error.
HTTPX_AddPostRaw native HTTPX_AddPostRaw(const data[]) /** * Number of parameters for the callbacks are 1 (DownloadID) for the progress event and 2 (DownloadID, Error) for the complete event. * Error codes: * 0 Download done. No problems encountered. * Positive returns is unhandled HTTP return codes. For example 404. * Negative is internal errors. * -1 No response code was found in the HTTP response header or it was outside the accepted range (200-307). * -2 Server is sending bad data or sizes for a chunked transfer or HTTPX has problems reading them. * -3 Nothing received in last packet. Most likely due to an error. * -4 HTTPX was redirected but could not follow due to a socket error. * -5 HTTPX was redirected too many times. Usually happens when server is insisting on a SSL/TLS connection which HTTPX does not support. **/ /** * HTTPX_Download(const URL[], const Filename[] = "", const CompleteHandler[] = "", const ProgressHandler[] = "", Port = (80<<443), RequestType = REQUEST_GET, const Username[] = "", const Password[] = "", ...) * * Begins download of a URL. Read parameters for information. * * * Parameters: * * const URL[] * URL that you want to download. * * (Optional) const Filename[] * Where should the information be stored? If no filename is entered it will download as a "stream". * This means the data will be thrown away after it passes the buffer. * You can read the data on progress forward and make use of it there.
HTTPX_AddPostVar native HTTPX_AddPostVar(const variable[], const value[]) /** * HTTPX_AddPostRaw(const data[]) * * Adds raw POST data to the request. * This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. * It can be used multiple times before each download. **/ native HTTPX_AddPostRaw(const data[]) /** * Number of parameters for the callbacks are 1 (DownloadID) for the progress event and 2 (DownloadID, Error) for the complete event. * Error codes: * 0 Download done. No problems encountered. * Positive returns is unhandled HTTP return codes. For example 404. * Negative is internal errors. * -1 No response code was found in the HTTP response header or it was outside the accepted range (200-307). * -2 Server is sending bad data or sizes for a chunked transfer or HTTPX has problems reading them. * -3 Nothing received in last packet. Most likely due to an error. * -4 HTTPX was redirected but could not follow due to a socket error. * -5 HTTPX was redirected too many times. Usually happens when server is insisting on a SSL/TLS connection which HTTPX does not support. **/ /** * HTTPX_Download(const URL[], const Filename[] = "", const CompleteHandler[] = "", const ProgressHandler[] = "", Port = (80<<443), RequestType = REQUEST_GET, const Username[] = "", const Password[] = "", ...) * * Begins download of a URL. Read parameters for information. * *
HTTPX_Download native HTTPX_Download(const URL[], const Filename[] = "", const CompleteHandler[] = "", const ProgressHandler[] = "", Port = 0, RequestType = REQUEST_GET, const Username[] = "", const Password[] = "", ... /* For possible future use */)
HTTPX_GetBytesReceived native HTTPX_GetBytesReceived(DownloadID) /** * HTTPX_GetBytesReceivedLarge(DownloadID, string[], len) * * Formats total ammount of bytes received for DownloadID in string form. **/ native HTTPX_GetBytesReceivedLarge(DownloadID, string[], len) /** * HTTPX_GetNewBytesReceived() * * Returns the ammount of bytes that was received in this chunk. **/ native HTTPX_GetNewBytesReceived() /** * HTTPX_GetFilesize(DownloadID) * * Returns the filesize of DownloadID. * If unknown it will return -1. **/ native HTTPX_GetFilesize(DownloadID) /** * HTTPX_GetFilesizeLarge(DownloadID, string[], len) * * Formats the large filesize of DownloadID in string form. **/ native HTTPX_GetFilesizeLarge(DownloadID, string[], len)
HTTPX_GetBytesReceivedLarge native HTTPX_GetBytesReceivedLarge(DownloadID, string[], len) /** * HTTPX_GetNewBytesReceived() * * Returns the ammount of bytes that was received in this chunk. **/ native HTTPX_GetNewBytesReceived() /** * HTTPX_GetFilesize(DownloadID) * * Returns the filesize of DownloadID. * If unknown it will return -1. **/ native HTTPX_GetFilesize(DownloadID) /** * HTTPX_GetFilesizeLarge(DownloadID, string[], len) * * Formats the large filesize of DownloadID in string form. **/ native HTTPX_GetFilesizeLarge(DownloadID, string[], len) /** * HTTPX_GetFilename(DownloadID) * * Returns the filename of DownloadID. **/ native HTTPX_GetFilename(DownloadID, name[], len)
HTTPX_GetData native HTTPX_GetData(data[], len) /** * Automatic updating * Updates current plugin automatically (from AlliedModders webpage only to prevent spreading of malicious code). * * * file_id[] has to be the same as it is on the forum webpage. (Check the link of the .amxx file ("Get Plugin" link)) * * * If frequency is supplied you can set how often to update the file. If none is provided it will update as soon as possible. * Please use this respectfully. Don't overload the AM forums. * * You can however provide your own method of determining whether the file needs to be updated or not before calling this function. * That way you don't stress AM servers when not required. An example of this is in the HTTPX source which uses this method. * * Examples: * 1d = 86400 * 1w = 604800 * 30d = 2592000 * * * IMPORTANT! * The reason for this not being a native is that it does not halt the plugin if HTTPX is not running. HTTPX and automatic updating is optional. * Use this example instead. the File ID is the attachment in your post on the AM forums. Only use the ID, not the whole URL. * For example: * The plugin Name Replacer by anakin_cstrike, @http://forums.alliedmods.net/showthread.php?t=77401&highlight=replacer * Scroll down and hover the "Get Plugin", there you see the file ID. Just replace the placeholder with that value. * #define AUTOUPDATE_FILE_ID "76775" * Add the time or create your own method of deciding when it's supposed to be updated and you're done.
HTTPX_GetFilename native HTTPX_GetFilename(DownloadID, name[], len) /** * HTTPX_GetData(data[], len) * * Fills variable data[] with the last chunk downloaded. * * len decides maxlen for the data[] variable. * Remember, this is raw data. * No need to make room for null at the end unless you're passing it to any function that is * trying to automatically find the end by searching for null (any string function). * * The function will return the ammount of bytes that was written to the data[] variable. * * By looping this function until it returns 0, you can get all the data. **/ native HTTPX_GetData(data[], len) /** * Automatic updating * Updates current plugin automatically (from AlliedModders webpage only to prevent spreading of malicious code). * * * file_id[] has to be the same as it is on the forum webpage. (Check the link of the .amxx file ("Get Plugin" link)) * * * If frequency is supplied you can set how often to update the file. If none is provided it will update as soon as possible. * Please use this respectfully. Don't overload the AM forums. * * You can however provide your own method of determining whether the file needs to be updated or not before calling this function.
HTTPX_GetFilesize native HTTPX_GetFilesize(DownloadID) /** * HTTPX_GetFilesizeLarge(DownloadID, string[], len) * * Formats the large filesize of DownloadID in string form. **/ native HTTPX_GetFilesizeLarge(DownloadID, string[], len) /** * HTTPX_GetFilename(DownloadID) * * Returns the filename of DownloadID. **/ native HTTPX_GetFilename(DownloadID, name[], len) /** * HTTPX_GetData(data[], len) * * Fills variable data[] with the last chunk downloaded. * * len decides maxlen for the data[] variable. * Remember, this is raw data. * No need to make room for null at the end unless you're passing it to any function that is * trying to automatically find the end by searching for null (any string function). * * The function will return the ammount of bytes that was written to the data[] variable. * * By looping this function until it returns 0, you can get all the data. **/
HTTPX_GetFilesizeLarge native HTTPX_GetFilesizeLarge(DownloadID, string[], len) /** * HTTPX_GetFilename(DownloadID) * * Returns the filename of DownloadID. **/ native HTTPX_GetFilename(DownloadID, name[], len) /** * HTTPX_GetData(data[], len) * * Fills variable data[] with the last chunk downloaded. * * len decides maxlen for the data[] variable. * Remember, this is raw data. * No need to make room for null at the end unless you're passing it to any function that is * trying to automatically find the end by searching for null (any string function). * * The function will return the ammount of bytes that was written to the data[] variable. * * By looping this function until it returns 0, you can get all the data. **/ native HTTPX_GetData(data[], len) /** * Automatic updating * Updates current plugin automatically (from AlliedModders webpage only to prevent spreading of malicious code). * *
HTTPX_GetNewBytesReceived native HTTPX_GetNewBytesReceived() /** * HTTPX_GetFilesize(DownloadID) * * Returns the filesize of DownloadID. * If unknown it will return -1. **/ native HTTPX_GetFilesize(DownloadID) /** * HTTPX_GetFilesizeLarge(DownloadID, string[], len) * * Formats the large filesize of DownloadID in string form. **/ native HTTPX_GetFilesizeLarge(DownloadID, string[], len) /** * HTTPX_GetFilename(DownloadID) * * Returns the filename of DownloadID. **/ native HTTPX_GetFilename(DownloadID, name[], len) /** * HTTPX_GetData(data[], len) * * Fills variable data[] with the last chunk downloaded. * * len decides maxlen for the data[] variable.
HTTPX_IsFilesizeLarge native bool:HTTPX_IsFilesizeLarge(DownloadID) /** * HTTPX_GetBytesReceived(DownloadID) * * Returns total ammount of bytes received for DownloadID. **/ native HTTPX_GetBytesReceived(DownloadID) /** * HTTPX_GetBytesReceivedLarge(DownloadID, string[], len) * * Formats total ammount of bytes received for DownloadID in string form. **/ native HTTPX_GetBytesReceivedLarge(DownloadID, string[], len) /** * HTTPX_GetNewBytesReceived() * * Returns the ammount of bytes that was received in this chunk. **/ native HTTPX_GetNewBytesReceived() /** * HTTPX_GetFilesize(DownloadID) * * Returns the filesize of DownloadID. * If unknown it will return -1. **/ native HTTPX_GetFilesize(DownloadID)
HTTPX_IsPaused native bool:HTTPX_IsPaused(DownloadID) /** * HTTPX_Paused(DownloadID) * * Pauses the download. **/ native HTTPX_Pause(DownloadID) /** * HTTPX_Unpause(DownloadID) * * Unpauses the download. **/ native HTTPX_Unpause(DownloadID) /** * HTTPX_Abort(DownloadID, bool:DeleteFile = true) * * Aborts the transfer of selected download DownloadID. * If DeleteFile is set to true the partially downloaded file will be deleted. **/ native HTTPX_Abort(DownloadID, bool:DeleteFile = true) /** * HTTPX_AddPostVar(const variable[], const value[]) * * Adds a POST variable to the request. * This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. * It can be used multiple times before each download.
HTTPX_Pause native HTTPX_Pause(DownloadID) /** * HTTPX_Unpause(DownloadID) * * Unpauses the download. **/ native HTTPX_Unpause(DownloadID) /** * HTTPX_Abort(DownloadID, bool:DeleteFile = true) * * Aborts the transfer of selected download DownloadID. * If DeleteFile is set to true the partially downloaded file will be deleted. **/ native HTTPX_Abort(DownloadID, bool:DeleteFile = true) /** * HTTPX_AddPostVar(const variable[], const value[]) * * Adds a POST variable to the request. * This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. * It can be used multiple times before each download. **/ native HTTPX_AddPostVar(const variable[], const value[]) /** * HTTPX_AddPostRaw(const data[]) * * Adds raw POST data to the request.
HTTPX_Unpause native HTTPX_Unpause(DownloadID) /** * HTTPX_Abort(DownloadID, bool:DeleteFile = true) * * Aborts the transfer of selected download DownloadID. * If DeleteFile is set to true the partially downloaded file will be deleted. **/ native HTTPX_Abort(DownloadID, bool:DeleteFile = true) /** * HTTPX_AddPostVar(const variable[], const value[]) * * Adds a POST variable to the request. * This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. * It can be used multiple times before each download. **/ native HTTPX_AddPostVar(const variable[], const value[]) /** * HTTPX_AddPostRaw(const data[]) * * Adds raw POST data to the request. * This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. * It can be used multiple times before each download. **/ native HTTPX_AddPostRaw(const data[]) /** * Number of parameters for the callbacks are 1 (DownloadID) for the progress event and 2 (DownloadID, Error) for the complete event.