|
1 | | - /* SA-MP threaded HTTP/1.0 client for pawn |
2 | | - * |
3 | | - * (c) Copyright 2010, SA-MP Team |
4 | | - * |
5 | | - */ |
6 | | - |
7 | | -// HTTP requests |
8 | | -#define HTTP_GET 1 |
9 | | -#define HTTP_POST 2 |
10 | | -#define HTTP_HEAD 3 |
11 | | - |
12 | | -// HTTP error response codes |
13 | | -// These codes compliment ordinary HTTP response codes returned in 'response_code' |
14 | | -// (10x) (20x OK) (30x Moved) (40x Unauthorised) (50x Server Error) |
15 | | -#define HTTP_ERROR_BAD_HOST 1 |
16 | | -#define HTTP_ERROR_NO_SOCKET 2 |
17 | | -#define HTTP_ERROR_CANT_CONNECT 3 |
18 | | -#define HTTP_ERROR_CANT_WRITE 4 |
19 | | -#define HTTP_ERROR_CONTENT_TOO_BIG 5 |
20 | | -#define HTTP_ERROR_MALFORMED_RESPONSE 6 |
21 | | - |
22 | | -/// <summary>Sends a threaded HTTP request.</summary> |
23 | | -/// <param name="index">ID used to differentiate requests that are sent to the same callback (useful for playerids)</param> |
24 | | -/// <param name="type">The type of request you wish to send</param> |
25 | | -/// <param name="url">The URL you want to request. (Without 'http://')</param> |
26 | | -/// <param name="data">Any POST data you want to send with the request</param> |
27 | | -/// <param name="callback">Name of the callback function you want to use to handle responses to this request</param> |
28 | | -/// <remarks>This function was added in <b>SA-MP 0.3b</b> and will not work in earlier versions!</remarks> |
29 | | -/// <returns><b><c>1</c></b> on success, <b><c>0</c></b> on failure.</returns> |
30 | | -/// <remarks> |
31 | | -/// <b>Request types:</b><p/> |
32 | | -/// <ul> |
33 | | -/// <li><b><c>HTTP_GET</c></b></li> |
34 | | -/// <li><b><c>HTTP_POST</c></b></li> |
35 | | -/// <li><b><c>HTTP_HEAD</c></b></li> |
36 | | -/// </ul> |
37 | | -/// </remarks> |
38 | | -/// <remarks> |
39 | | -/// <b>Response codes:</b><p/> |
40 | | -/// <ul> |
41 | | -/// <li><b><c>HTTP_ERROR_BAD_HOST</c></b></li> |
42 | | -/// <li><b><c>HTTP_ERROR_NO_SOCKET</c></b></li> |
43 | | -/// <li><b><c>HTTP_ERROR_CANT_CONNECT</c></b></li> |
44 | | -/// <li><b><c>HTTP_ERROR_CANT_WRITE</c></b></li> |
45 | | -/// <li><b><c>HTTP_ERROR_CONTENT_TOO_BIG</c></b></li> |
46 | | -/// <li><b><c>HTTP_ERROR_MALFORMED_RESPONSE</c></b></li> |
47 | | -/// <li>+ standard HTTP response codes</li> |
48 | | -/// </ul> |
49 | | -/// </remarks> |
50 | | -native HTTP(index, type, const url[], const data[], const callback[]); |
51 | | - |
52 | | -// example HTTP callback: public MyHttpResponse(index, response_code, data[]) { ... } |
| 1 | + /* SA-MP threaded HTTP/1.0 client for pawn |
| 2 | + * |
| 3 | + * (c) Copyright 2010, SA-MP Team |
| 4 | + * |
| 5 | + */ |
| 6 | + |
| 7 | +// HTTP requests |
| 8 | +#define HTTP_GET 1 |
| 9 | +#define HTTP_POST 2 |
| 10 | +#define HTTP_HEAD 3 |
| 11 | + |
| 12 | +// HTTP error response codes |
| 13 | +// These codes compliment ordinary HTTP response codes returned in 'response_code' |
| 14 | +// (10x) (20x OK) (30x Moved) (40x Unauthorised) (50x Server Error) |
| 15 | +#define HTTP_ERROR_BAD_HOST 1 |
| 16 | +#define HTTP_ERROR_NO_SOCKET 2 |
| 17 | +#define HTTP_ERROR_CANT_CONNECT 3 |
| 18 | +#define HTTP_ERROR_CANT_WRITE 4 |
| 19 | +#define HTTP_ERROR_CONTENT_TOO_BIG 5 |
| 20 | +#define HTTP_ERROR_MALFORMED_RESPONSE 6 |
| 21 | + |
| 22 | +/// <summary>Sends a threaded HTTP request.</summary> |
| 23 | +/// <param name="index">ID used to differentiate requests that are sent to the same callback (useful for playerids)</param> |
| 24 | +/// <param name="type">The type of request you wish to send</param> |
| 25 | +/// <param name="url">The URL you want to request. (Without 'http://')</param> |
| 26 | +/// <param name="data">Any POST data you want to send with the request</param> |
| 27 | +/// <param name="callback">Name of the callback function you want to use to handle responses to this request</param> |
| 28 | +/// <remarks>This function was added in <b>SA-MP 0.3b</b> and will not work in earlier versions!</remarks> |
| 29 | +/// <returns><b><c>1</c></b> on success, <b><c>0</c></b> on failure.</returns> |
| 30 | +/// <remarks> |
| 31 | +/// <b>Request types:</b><p/> |
| 32 | +/// <ul> |
| 33 | +/// <li><b><c>HTTP_GET</c></b></li> |
| 34 | +/// <li><b><c>HTTP_POST</c></b></li> |
| 35 | +/// <li><b><c>HTTP_HEAD</c></b></li> |
| 36 | +/// </ul> |
| 37 | +/// </remarks> |
| 38 | +/// <remarks> |
| 39 | +/// <b>Response codes:</b><p/> |
| 40 | +/// <ul> |
| 41 | +/// <li><b><c>HTTP_ERROR_BAD_HOST</c></b></li> |
| 42 | +/// <li><b><c>HTTP_ERROR_NO_SOCKET</c></b></li> |
| 43 | +/// <li><b><c>HTTP_ERROR_CANT_CONNECT</c></b></li> |
| 44 | +/// <li><b><c>HTTP_ERROR_CANT_WRITE</c></b></li> |
| 45 | +/// <li><b><c>HTTP_ERROR_CONTENT_TOO_BIG</c></b></li> |
| 46 | +/// <li><b><c>HTTP_ERROR_MALFORMED_RESPONSE</c></b></li> |
| 47 | +/// <li>+ standard HTTP response codes</li> |
| 48 | +/// </ul> |
| 49 | +/// </remarks> |
| 50 | +native HTTP(index, type, const url[], const data[], const callback[]); |
| 51 | + |
| 52 | +// example HTTP callback: public MyHttpResponse(index, response_code, data[]) { ... } |
0 commit comments