02.01.2020, 21:38
Good community, I want to know how I can send data with the plugin a_http but using post because in the example of the wiki it is only with get
|
Good community, I want to know how I can send data with the plugin a_http but using post because in the example of the wiki it is only with get
|
format(query, sizeof(query), "user=%s&email=%s&code=%s&hash=%s&token=thetoken", urlencode(PlayerName(playerid)), urlencode(email), urlencode(code), urlencode(verification_hash));
// Send the verification email
HTTP(playerid, HTTP_POST, "activations.example.com/include/verification_email.php", query, "HTTP_SendVerificationEmail");
forward HTTP_SendVerificationEmail(index, response_code, data[]);
public HTTP_SendVerificationEmail(index, response_code, data[])
{
if (response_code == 200)
{
LOG_DEBUG_F("Success: %s", data);
}
else
{
LOG_DEBUG_F("Failed: %d", response_code);
}
}
native HTTP(index, type, url[], data[], callback[]);
// Trace the IP address
new ip_locate_q[60];
format(ip_locate_q, sizeof(ip_locate_q), "thegeoapi.com/csv/%s?fields=status,country,city", PlayerIP(playerid));
HTTP(playerid, HTTP_GET, ip_locate_q, "", "HTTP_OnIpTraced");
forward HTTP_OnIpTraced(index, response_code, data[]);
public HTTP_OnIpTraced(index, response_code, data[])
{
new connect_msg[128],
connect_msg_admin[128],
connect_msg_panel[78];
....
}