14.12.2013, 12:11
Hey guys just trying out the HTTP functions within the a_http include to check some information in a mysql database but for some reason it keeps returning an error code (6) wich doesn't exist as far as i know.
Note: i'm trying to get it to check the information via localhost.
Note: i'm trying to get it to check the information via localhost.
pawn Код:
#include <a_samp>
#include <a_mysql>
#include <a_http>
#include <sscanf2>
#include <zcmd>
#define GAMEMODE_TEST ""
#define MYSQL_HOST ""
#define MYSQL_USER ""
#define MYSQL_DATA ""
#define MYSQL_PASS ""
#define URL_CHECK_WALLET "localhost/http_walletcheck.php"
//***************************************************************************************************
forward HttpResponse_WalletCheck(index, response_code, data[]);
//***************************************************************************************************
main()
{
}
public OnGameModeInit()
{
print("test");
}
public HttpResponse_WalletCheck(index, response_code, data[])
{
new playerid = index;
if(response_code == 200)
{
if(strcmp(data,"true",true) == 0)
{
SendClientMessage(playerid, -1, "we completed your transaction...");
} else {
SendClientMessage(playerid, -1, "we could not complete your transaction, please try again.");
}
} else {
new str[1048];
format(str,sizeof(str), "An error occured when processing your transaction. (RESPONSE: %d)", response_code);
SendClientMessage(playerid, -1, str);
}
}
COMMAND:checkwallet(playerid, params[])
{
new str[500];
format(str,sizeof(str),"userid=%dwalletbalance=%d",1,1);
HTTP(playerid, HTTP_POST, URL_CHECK_WALLET, str, "HttpResponse_WalletCheck");
return 1;
}