AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Reading Web Content info ? (https://forums.alliedmods.net/showthread.php?t=337436)

Craxor 04-20-2022 13:16

Reading Web Content info ?
 
Hi, I am trying to make a plugin to retrieve from game tracker the "ALL TIME STATS" Info per user .

I've browesd the forum a little and found tons of Modules/INC wich I "suspect" (because i am not sure and i am realy noob at this) this could be made trough them, Sockets, cURL, THREADED HTPP, HTTP:X, HTTP, HTPPX, bla bla and so on, my questionS are :

1. Wich is the easiest/friendly-user to learn and use in my goal?
2. Wich is the fastest ( as i read, some are called after a while, idk wich, is there one wich could make to retrieve the Info almost instantly for the user eyes? I am trying to make an plugin wich when users type /playedtime, will show a menu or an motd with his ALL TIME STATS on gametracker ) .
3. How to actualy done it, please a little support :P (this if answered to the other two questions ) .

Thanks in advance guys .

Natsheh 04-20-2022 21:34

Re: Reading Web Content info ?
 
Use curl module, or sockets if you're reading only http requests.

bigdaddy424 04-20-2022 21:55

Re: Reading Web Content info ?
 
https://github.com/bigdaddy424/alliedmods-scraped-api
There's plenty of tutorials how to scrape data from websites. As long as these websites don't have anti-bot captchas you're safe.

Craxor 04-21-2022 01:11

Re: Reading Web Content info ?
 
Nathseh thank ill give a try with curl module, but curl module does require any special instalation or is an module as any others ?

Bigdaddy, the link you provide has no example in it, what about it?

Natsheh 04-21-2022 01:24

Re: Reading Web Content info ?
 
yes you need to install the module not a big deal its not included in the normal amxmodx package so yes.

Craxor 04-21-2022 05:40

Re: Reading Web Content info ?
 
Quote:

Originally Posted by Natsheh (Post 2777422)
yes you need to install the module not a big deal its not included in the normal amxmodx package so yes.

Lol, no , what i mean is "Beside" the module does require any meta special plugin or somrthing like that? Or i imstall it like any other normal Module?
.i readed the comments from the topic and Prostetamoto said something about an Meta plugin or something like that , i couldnt grasp the conversation because were too much for me .

Natsheh 04-21-2022 08:25

Re: Reading Web Content info ?
 
No its an amxx module, nothing required.

Craxor 04-21-2022 13:02

Re: Reading Web Content info ?
 
Nat. , i readed a little about CURL, but is fucking complicated, are you sure is easier with Curl rather than Sockets ? ( I mean when you have zero knowledeb about subject as me ) .

Anyway .

What exactly does Curl? Please explain in normal terms not programmer terms .

If i use curl to retrieve data from an Gametracker page of an User, could i Read one of more Info from there just by inserting an Key ?

Or the CURL function would downloand an entire page and i have to use Regex to search for my keywords and delete the rest of the content ?

I found this website ( https://reqbin.com/req/c-1n4ljxb9/cu...equest-example )

If i use CURL on gametracker of an player page, would give me an PHP source code ,

Does that mean the Curl module uses getinfo function to download source codes of the http i insert, and i have to use Regex in order to substring my info i need to retrieve ?

I'm sorry but i am really confused about how this module works, and all the info and people were talking about it made it even more confusing because they were talking in PROGRAMMING terms, but i'm not an programmer .

Natsheh 04-21-2022 13:34

Re: Reading Web Content info ?
 
Sockets only retrieves data using HTTP request while cURL support multiple protocols & requests.

CrazY. 04-21-2022 14:40

Re: Reading Web Content info ?
 
Do not use sockets for that purpose, stick with curl.
https://github.com/Next21Team/AmxxCurl

I won't go in-depth about the differences but with sockets, if you do multiple requests within a short interval of time, you may receive the response all at once instead of in pieces for each request, you wouldn't know which request the response belongs to. You don't have this problem with curl, all you really need is to send the request, once curl receives the response, it will trigger the callback.

Curl is pretty simple, there is plenty of information on google, just search.
There is even a couple of examples of how to use AmxxCurl module, https://github.com/Next21Team/AmxxCu...r/amx_examples

Now regarding how to get the stats of a player, you won't request the stats page, instead, you have to request the gametracker API, it will return either an XML or a JSON response containing all the information of the specified player.

Alternatively, you could just show a motd pointing to the player stats page.


All times are GMT -4. The time now is 21:20.

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