-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform-post.pwn
More file actions
32 lines (27 loc) · 891 Bytes
/
form-post.pwn
File metadata and controls
32 lines (27 loc) · 891 Bytes
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
// form-post.pwn — build an application/x-www-form-urlencoded payload.
//
// Demonstrates:
// * Accumulating key/value pairs across multiple https_form_add calls.
// * The builder setting Content-Type automatically.
// * Sending a POST whose body comes entirely from the staged form.
#include <a_samp>
#include <https_samp>
public OnGameModeInit()
{
https_form_add("username", "erick");
https_form_add("password", "s3cret");
https_form_add("remember", "1");
https(1, HTTPS_POST, "https://httpbin.org/post", "", "OnFormPost");
return 1;
}
forward OnFormPost(index, response[], status, error);
public OnFormPost(index, response[], status, error)
{
if (error != HTTPS_ERROR_NONE)
{
printf("[example] form %d failed: error=%d", index, error);
return 1;
}
printf("[example] form %d ok: status=%d", index, status);
return 1;
}