Raised This Month: $ Target: $400
 0% 

Socket help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 12-20-2018 , 09:18   Re: Socket help
Reply With Quote #4

Code:
#include < amxmodx >
#include < amxmisc >
#include < sockets >

#define FILE	"addons/amxmodx/configs/page.txt"

new Socket, Error;

public plugin_init ( )	set_task ( 2.0, "SavePage" );
public SavePage ( )
{
	Socket = socket_open ( "www.csservers.ro", 80, SOCKET_TCP, Error );
	
	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 ) );
					write_file ( FILE, DataRecived );
					server_print ( "[Sockets] Page Saved" );
				}
			}

			socket_close ( Socket );

		}
	}
}
With this i get the page content. This is the page: https://pastebin.com/ntfwxvj2

From this page i need:

Code:
<div class="floating ui red label" title="Voturi azi"><a href="http://www.csservers.ro/evidenta/zm.darkland.ro/voturi-azi">13</a></div>
Only number 13 i need to store in a variable.
__________________
LondoN is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode