HTTP and localhost
#1

Hello,
I have a problem with http and localhost. I need to make it work on my localhost for testing.
I have this script, please advise me where create a file "test.txt" to be read.

Код:
#include <a_samp>
#include <a_http>

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(strcmp("/http",cmdtext,true) == 0)
    {
        HTTP(playerid,HTTP_GET,"localhost/test.txt","","MyHttpResponse");
        return 1;
    }
	return 0;
}

forward MyHttpResponse(index,response_code,data[]);
public MyHttpResponse(index,response_code,data[])
{
	new s[128];
	format(s,128,"index = %d",index);
	SendClientMessageToAll(-1,s);
	format(s,128,"response_code = %d",response_code);
	SendClientMessageToAll(-1,s);
	format(s,128,"data = %s",data);
	SendClientMessageToAll(-1,s);
    return 1;
}
now response_code is 3
Reply


Forum Jump:


Users browsing this thread: