http -
CrazyChoco - 25.09.2012
Well hello peoples, i made out this script to just try it and put it on my gamemode
pawn Код:
CMD:test(playerid, params[])
{
HTTP(playerid, HTTP_GET, "sagamerz.comli.com/test/sss.txt", "", "MyHttpResponse");
return 1;
}
forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
// In this callback "index" would normally be called "playerid" ( if you didn't get it already :) )
new
buffer[ 128 ];
if(response_code == 200) //Did the request succeed?
{
//Yes!
format(buffer, sizeof(buffer), "The URL replied: %s", data);
SendClientMessage(index, 0xFFFFFFFF, buffer);
}
else
{
//No!
format(buffer, sizeof(buffer), "The request failed! The response code was: %d", response_code);
SendClientMessage(index, 0xFFFFFFFF, buffer);
}
}
But when i try the cmd, i get error code 6 or aka. HTTP_ERROR_MALFORMED_RESPONSE 6
I dont know how it comes, its only in-game, not in pawno, it dosnt tell me anything compiles fine. But ingame is the problem
Re: http -
Vince - 25.09.2012
I also always get HTTP status code 6, yet the function seems to work absolutely fine. I could even send post data to a mailer script and it worked fine.
Re: http -
CrazyChoco - 25.09.2012
Then the problem is with my gamemode?
Re: http -
Vince - 25.09.2012
More likely the webserver.
Re: http -
CrazyChoco - 25.09.2012
I tried with an other webserver too, but i still receive the same response code.
Re: http -
CrazyChoco - 25.09.2012
I also tried with this code:
pawn Код:
#include <a_http>
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/test", cmdtext, true, 10) == 0)
{
HTTP(playerid, HTTP_GET, "sagamerz.comli.com/test/sss.txt", "", "MyHttpResponse");
return 1;
}
return 0;
}
forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
// In this callback "index" would normally be called "playerid" ( if you didn't get it already :) )
new
buffer[ 128 ];
if(response_code == 200) //Did the request succeed?
{
//Yes!
format(buffer, sizeof(buffer), "The URL replied: %s", data);
SendClientMessage(index, 0xFFFFFFFF, buffer);
}
else
{
//No!
format(buffer, sizeof(buffer), "The request failed! The response code was: %d", response_code);
SendClientMessage(index, 0xFFFFFFFF, buffer);
}
}
I still get the same response code. Any ideas why?
Re: http -
CrazyChoco - 25.09.2012
Can't anyone see if there is anything wrong, or know why this error occured