Get only 8th line from array
Hi,
I use sockets module ant i get data from web server. I'm new in scripting. Sockets returns that for me: HTTP/1.1 200 OK Date: Thu, 07 Aug 2008 18:57:16 GMT Server: Apache Transfer-Encoding: chunked Content-Type: text/html 5 lukas 0 That returns my buf[512] array. How can i get only "lukas" (8th line) from this? |
Re: Get only 8th line from array
Loop through the array and count the \n (new line) characters.
|
Re: Get only 8th line from array
try this.
Code:
|
Re: Get only 8th line from array
zwfgdlc, text variable returns nothing :/ Is in pawn explode function, like PHP ?
|
Re: Get only 8th line from array
Here what I've done.
Method without any extra checks. ( So, no safe depending how you use it. But, if the buffer is always the same, it's perfectly fine :) ) Code:
So, to retrieve name : Code:
Tested and it works. Is it enough for you ? I mean you want just to retrieve the name, that's all ? Maybe do you want a more safe method and more general ? ( eg, like retrieving the line of your choice, etc. ) |
Re: Get only 8th line from array
Ant i think, while() cycle doesn't work here, because server_print() does not print anything:
Code:
/* Plugin generated by AMXX-Studio */ |
Re: Get only 8th line from array
arkshine, man , it works! Thank you so mutch dude :) Karma+
|
| All times are GMT -4. The time now is 05:32. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.