12.04.2012, 02:16
pawn Код:
Call_GetPlayerCity(playerid)
{
new ip[16];
GetPlayerIp(playerid, ip, sizeof(ip));
new URL[200] = "geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=";
strcat(URL, ip);
HTTP(playerid, HTTP_GET, URL, "", "MyHttpResponse");
}
forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
if(response_code != 200) return;
new start = strfind(data, "\"city\" content=");
start += 16;
strdel(data, 0, start);
new end = strfind(data, "\"");
data[end] = EOS;
print(data); // City here...
}