Socket help
Hello, i'm tring to retrive a html page by sockets but i don't know how to parse page to retry a number of votes showed in the page.
www.csservers.ro/evidenta/zm.darkland.ro - this is the page The sockets retrive me full html who is bigger. Can someone help pe to retrive onli the votes number in a variable? |
Re: Socket help
you mean to get 'zm_snowbase3 - 29.16%' for example?
edit: in that case maybe using https://forums.alliedmods.net/showthread.php?t=63120 + regex |
Re: Socket help
Use the http include file to download the full html page. Provide a sample of the content and we can help you parse the data you want.
|
Re: Socket help
Code:
#include < amxmodx > 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> |
Re: Socket help
You need to give the http server time to respond. Like I said, use the http include.
|
Re: Socket help
/voturi-azi" can be used as a unique key for a search. ( with containi() ).
From the next char (between > and < ) you will find your desired number. |
Re: Socket help
you can try with this, i had similar topic : https://forums.alliedmods.net/showthread.php?t=311173
Code:
#include <httpx> |
Re: Socket help
PHP Code:
|
Re: Socket help
Code:
#include < amxmodx > With regex hmm.. i will try this |
Re: Socket help
Chances are slim but there is a possibility your data is getting cut-off as you read chunks from the socket into your buffer. This would cause an issue if the break is in the middle of the string you are searching for. You should download the file (using an HTTP include), and then scan the file for the data you want. Or, if this file is not huge, make your buffer bigger and read everything into the buffer, concatenating the data with each socket_read().
To see if this is the case, print the data into the console as it comes in to see if it's all in one piece: Code:
|
All times are GMT -4. The time now is 18:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.