Ant i think, while() cycle doesn't work here, because server_print() does not print anything:
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <sockets>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "SwataZ"
new g_sckweb //socket "id"
#define SCRIPT_NAME "/indexas.php"
#define REMOTE_HOST "c-s.lt" //port d.80
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task(1.0, "dispTime", 0, "", 0, "b")
// Add your code here...
}
public dispTime()
{
new error = 0
new constring[512]
new timeout
g_sckweb = socket_open(REMOTE_HOST, 80, SOCKET_TCP, error)
if (g_sckweb > 0) {
format(constring,511,"GET %s HTTP/1.1^nHost: %s^n^n",SCRIPT_NAME,REMOTE_HOST)
socket_send(g_sckweb,constring, 511)
new buf[512]
timeout=0
socket_recv(g_sckweb, buf, 511)
new text[32];
new line=1;
new pos=-1;
new start=-1;
new end=-1;
while(pos=strfind(buf,"\n") != -1)
{
line++;
if(line==8)
start=pos;
if(line==9)
{
end=pos;
copy(text,end-start,buf[start]);
server_print("Startas: %d Endas: %d bufas: %s",start,end,buf);
}
}
//set_hudmessage(255, 255, 255, 0.8, 0.1, 0)
}
}