-
Notifications
You must be signed in to change notification settings - Fork 3
/
httppost.c
50 lines (43 loc) · 975 Bytes
/
httppost.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Performs a HTTP POST request to a custom website. Used features :
* - Performing a HTTP POST request.
*
* This is the content of the target file (post.php) :
* \code
* <?php
* print_r($_POST);
* ?>
* \endcode
*/
#include <internet.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(void)
{
os_ClrHome();
printf("WEB Connection... ");
web_Init();
while(!web_Connected() && !os_GetCSC()) {
web_WaitForEvents();
}
if(!web_Connected()) {
printf("\nCanceled!\n");
goto _end;
}
printf("Done!\n");
printf("HTTP Request...");
http_data_t *data = NULL;
web_status_t status = web_HTTPPost("geometrydash.fr.nf/internetce/post.php", &data, false, 2, "azer", "wesh",
"83pce", "yeet");
if(status == HTTP_STATUS_OK) {
os_ClrHome();
printf("%.*s", data->size, data->data);
} else {
printf("Err %u: couldn't retrieve foreign data\n", status);
}
_end:
while(!os_GetCSC()) {}
web_Cleanup();
return 0;
}