Code:
#include < amxmodx >
#include < amxmisc >
#include < sockets >
#define FILE "addons/amxmodx/configs/page.txt"
new Socket, Error;
new const FindLine [ ] = "<a href=^"http://www.csservers.ro/evidenta/zm.darkland.ro/voturi-azi^">";
new const FindLine2 [ ] = "</a></div>";
public plugin_init ( ) set_task ( 2.0, "SavePage" );
public SavePage ( )
{
Socket = socket_open ( "www.csservers.ro", 80, SOCKET_TCP, Error );
new Pos, Pos2;
new Result [ 3 ];
if ( Socket > 0 )
{
new Query [ 512 ], DataRecived [ 2048 ];
formatex ( Query, charsmax ( Query ), "GET /evidenta/zm.darkland.ro HTTP/1.1^r^nHost:www.csservers.ro^r^nConnection: close^r^n^r^n" );
if ( !Error )
{
socket_send ( Socket, Query, charsmax ( Query ) );
while ( socket_recv ( Socket, DataRecived, charsmax ( DataRecived ) ) )
{
if ( socket_change ( Socket, 1 ) )
{
socket_recv ( Socket, DataRecived, charsmax ( DataRecived ) );
Pos = strfind ( DataRecived, FindLine );
Pos2 = strfind ( DataRecived, FindLine2, Pos );
if ( ( Pos > -1 ) && ( Pos2 > -1 ) )
{
copyc ( Result, charsmax ( Result ), DataRecived [ Pos + ( sizeof ( FindLine ) -1 ) ], Pos2 - ( sizeof ( FindLine2 ) -1 ) );
server_print ( "Votes: %d", str_to_num ( Result ) );
}
}
}
socket_close ( Socket );
}
}
}
I've tried to strfiind in DataRecived but no server_print in console..that's not good

)
With regex hmm.. i will try this
__________________