NoMoreFury Posted May 18, 2015 Share Posted May 18, 2015 Hello guys i have an question that i need to know how to add ETS2mp game Servers status on my WEbsite This a Little question that i asked Please help me MY IN-Game Status Is: Feel Free to Add me on Steam My pc specs (Updated) [url=https://valid.x86.fr/212q0h][img]https://valid.x86.fr/cache/banner/212q0h-5.png[/img][/url] Link to comment Share on other sites More sharing options...
delboyspencer Posted May 18, 2015 Share Posted May 18, 2015 Asking the question now for you. Regards Spencer MY Ingame Status: In game rules can be found here:https://forum.truckersmp.com/index.php?/forum/115-in-game-rules/ Link to comment Share on other sites More sharing options...
Game Developer mwl4 Posted May 18, 2015 Game Developer Share Posted May 18, 2015 http://api.ets2mp.com/servers/ Source: http://forum.ets2mp.com/index.php?/topic/2928-for-web-developers-rest-api-documentation/ Link to comment Share on other sites More sharing options...
NoMoreFury Posted May 18, 2015 Author Share Posted May 18, 2015 http://api.ets2mp.com/servers/ Source: http://forum.ets2mp.com/index.php?/topic/2928-for-web-developers-rest-api-documentation/ @mwi4 can you make a video of it i cant understand please MY IN-Game Status Is: Feel Free to Add me on Steam My pc specs (Updated) [url=https://valid.x86.fr/212q0h][img]https://valid.x86.fr/cache/banner/212q0h-5.png[/img][/url] Link to comment Share on other sites More sharing options...
DevOps Kat_pw Posted May 18, 2015 DevOps Share Posted May 18, 2015 @mwi4 can you make a video of it i cant understand please If you're not sure how to parse the api it may just be better idea to link to the status page. It can be complex if you do not know how to with php or language of your choice. Traffic Cameras : twitch.tv/kat_pw | Ets2Map : ets2map.comKat_pw Status:[CCTV #1] Status:[CCTV #2] Status:[CCTV #3] Status: Link to comment Share on other sites More sharing options...
Gonzalez Posted May 18, 2015 Share Posted May 18, 2015 Why not just "copy" the status page basically? (I haven't looked at the source yet but I'm sure you could just copy it lol ) Link to comment Share on other sites More sharing options...
Darth Wazawai Posted May 19, 2015 Share Posted May 19, 2015 ^ problem with C&P is you are consuming the servers resources. the API sends raw data which can be put into various pieces which a web dev could make use of example php you can use explode based on "{" using said expression it should do this: "error":"false","response":["id":1,"ip":"1.eu.game.ets2mp.com","port":42850,"name":"Europe #1","shortname":"EU #1","online":true,"players":926,"maxplayers":2300,"speedlimiter":1},"id":3,"ip":"1.us.game.ets2mp.com","port":42850,"name":"United states #1","shortname":"US #1","online":false,"players":0,"maxplayers":1500,"speedlimiter":1},"id":4,"ip":"2.eu.game.ets2mp.com","port":42880,"name":"Europe #2","shortname":"EU #2","online":true,"players":112,"maxplayers":2300,"speedlimiter":1}]} Next would be using another explode. HOWEVER this is resource intensive (or can be) using the same method as you said to grab the code you can use the same function to collect the API info. It's called cURL it request the website and using various functions you can collect the code in one line break it down and echo or collect as needed. i had one from back in my RuneScape days (3+ years ago) but i have had HDD failure/corruption since then... But the function you need will be preg_match i believe for php (equal in other program languages). ONLY request server updates every min MAX, as they only update it every minute. personally 5 minutes should work... This can be set via a cron job Signature removed by a wondering ghost Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2015 Share Posted May 19, 2015 ^ problem with C&P is you are consuming the servers resources. the API sends raw data which can be put into various pieces which a web dev could make use of example php you can use explode based on "{" using said expression it should do this: "error":"false","response":["id":1,"ip":"1.eu.game.ets2mp.com","port":42850,"name":"Europe #1","shortname":"EU #1","online":true,"players":926,"maxplayers":2300,"speedlimiter":1},"id":3,"ip":"1.us.game.ets2mp.com","port":42850,"name":"United states #1","shortname":"US #1","online":false,"players":0,"maxplayers":1500,"speedlimiter":1},"id":4,"ip":"2.eu.game.ets2mp.com","port":42880,"name":"Europe #2","shortname":"EU #2","online":true,"players":112,"maxplayers":2300,"speedlimiter":1}]}Next would be using another explode. HOWEVER this is resource intensive (or can be) using the same method as you said to grab the code you can use the same function to collect the API info. It's called cURL it request the website and using various functions you can collect the code in one line break it down and echo or collect as needed. i had one from back in my RuneScape days (3+ years ago) but i have had HDD failure/corruption since then... But the function you need will be preg_match i believe for php (equal in other program languages). ONLY request server updates every min MAX, as they only update it every minute. personally 5 minutes should work... This can be set via a cron job may I point your attention to json_decode()? Explode is a bad idea, usually will cause you more trouble than good. Same goes for "preg_match"(aka. regex.) Here's blog post by Jeff Atwood on why regex is a bad idea in a scenario like this. If you still can't figure it out, I'd suggest picking up a good book on php 5.6(or 5.5, but nothing older!) and learn how to write php. Alternatively have a look at Code Academy I've followed their python track myself and that seemed to be pretty good. Why not just "copy" the status page basically? (I haven't looked at the source yet but I'm sure you could just copy it lol )Nope, the new status page is server side, so if you copy it, you'll only get the current count and it won't update. Link to comment Share on other sites More sharing options...
NoMoreFury Posted May 19, 2015 Author Share Posted May 19, 2015 ok i have forum that im using ip.board 3.7.6 and i wanted to add status page on ip.board forum let me know code of it pls? MY IN-Game Status Is: Feel Free to Add me on Steam My pc specs (Updated) [url=https://valid.x86.fr/212q0h][img]https://valid.x86.fr/cache/banner/212q0h-5.png[/img][/url] Link to comment Share on other sites More sharing options...
Darth Wazawai Posted May 19, 2015 Share Posted May 19, 2015 Next to creating a custom link/page on your forum tuxyQ and I have given you all the required answers Also if you want to collect the data you display you will need to learn the new SQL methods of connecting, reason is while it's still being maintained (bugs etc) it'll eventually die. I've yet to select my new flavor but I've not had time to read up on either http://php.net/manual/en/mysqlinfo.api.choosing.php Also a good reason to pick up a book or anything 5.5 or newer as stated by tux, tho i know tons things changed between said versions. I'm running 5.3 on my servers, but once I get time to I'll be upgrading to the newest If you ask tux nicely they might make you a simple script. I don't really have time too. But imo it be a good idea to try it your self first @tuxyQ I bumped into the json decode while I was working on the runescape stuff but I never could use it (not sure if they have a API now, but nor do I care lol). Equally forgot about said command... Signature removed by a wondering ghost Link to comment Share on other sites More sharing options...
NoMoreFury Posted May 19, 2015 Author Share Posted May 19, 2015 Next to creating a custom link/page on your forum tuxyQ and I have given you all the required answers Also if you want to collect the data you display you will need to learn the new SQL methods of connecting, reason is while it's still being maintained (bugs etc) it'll eventually die. I've yet to select my new flavor but I've not had time to read up on either http://php.net/manual/en/mysqlinfo.api.choosing.php Also a good reason to pick up a book or anything 5.5 or newer as stated by tux, tho i know tons things changed between said versions. I'm running 5.3 on my servers, but once I get time to I'll be upgrading to the newest If you ask tux nicely they might make you a simple script. I don't really have time too. But imo it be a good idea to try it your self first @tuxyQ I bumped into the json decode while I was working on the runescape stuff but I never could use it (not sure if they have a API now, but nor do I care lol). Equally forgot about said command... so can you make it for me for ipboard forums? Script? MY IN-Game Status Is: Feel Free to Add me on Steam My pc specs (Updated) [url=https://valid.x86.fr/212q0h][img]https://valid.x86.fr/cache/banner/212q0h-5.png[/img][/url] Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2015 Share Posted May 19, 2015 For IPb I'd say learn how to do the script yourself, when(and it will) it breaks, you will also know how to fix it. Also if you want to collect the data you display you will need to learn the new SQL methods of connecting, reason is while it's still being maintained (bugs etc) it'll eventually die. I've yet to select my new flavor but I've not had time to read up on either http://php.net/manual/en/mysqlinfo.api.choosing.php Today I'd say don't bother with doing mysql the hard way, use an ORM like Doctrine, Idiorm(my personal favorite) or Redbean. Link to comment Share on other sites More sharing options...
Darth Wazawai Posted May 19, 2015 Share Posted May 19, 2015 No time, a 3 day convention is this weekend (Friday-Sunday), work, and this: http://forum.ets2mp.com/index.php?/topic/12912-the-most-comprehensive-suggestion-ever-xd/ All you need is 2 files. One to collect the API every x min (as stated 5 should work) One to display on the site. This well prevent your users from requesting the API server every time they load your page I like to keep busy Edit: tux your fav looks like mysql pdo lol Signature removed by a wondering ghost Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2015 Share Posted May 19, 2015 Edit: tux your fav looks like mysql pdo lolIt's basicly PDO, but not restricted to mysql, so if you decide to add point data it'll use any of the supported DBRM's native datatype for it (eg. Postgres or Mysql 5.6 has datatypes for point and other spacial data formats) Link to comment Share on other sites More sharing options...
zyprexia Posted May 19, 2015 Share Posted May 19, 2015 ^ problem with C&P is you are consuming the servers resources. the API sends raw data which can be put into various pieces which a web dev could make use of example php you can use explode based on "{" using said expression it should do this: "error":"false","response":["id":1,"ip":"1.eu.game.ets2mp.com","port":42850,"name":"Europe #1","shortname":"EU #1","online":true,"players":926,"maxplayers":2300,"speedlimiter":1},"id":3,"ip":"1.us.game.ets2mp.com","port":42850,"name":"United states #1","shortname":"US #1","online":false,"players":0,"maxplayers":1500,"speedlimiter":1},"id":4,"ip":"2.eu.game.ets2mp.com","port":42880,"name":"Europe #2","shortname":"EU #2","online":true,"players":112,"maxplayers":2300,"speedlimiter":1}]} Next would be using another explode. HOWEVER this is resource intensive (or can be) using the same method as you said to grab the code you can use the same function to collect the API info. It's called cURL it request the website and using various functions you can collect the code in one line break it down and echo or collect as needed. i had one from back in my RuneScape days (3+ years ago) but i have had HDD failure/corruption since then... But the function you need will be preg_match i believe for php (equal in other program languages). ONLY request server updates every min MAX, as they only update it every minute. personally 5 minutes should work... This can be set via a cron job Or you could just use the json_decode function! To read the JSON data, you can simply use the fopen function and pass the url as the filename. No need to re-invent the wheel here. You could than pass the returned array to your template engine and render the data on your website. 510 Horses and one lucky bird at work Simulators: Prepar3d V4, X-Plane 11, DCS 1.5 + 2.x, ETS2, ATS, Farming Simulator 17, Omsi 1 + 2 System: Intel i7-6700K @ 4700Mhz, 32GB DDR4 Corsair Vengeance LPX, GTX970, HP LP2475w monitor (1920x1200) Devices: Logitech G27, SKRS Shifter, CH Products Throttle Quadrant, Trustmaster Hotas Joystick, TrackIR Storage: 2 x SM961 - 250GB (raid 0), Samsung 850 pro 1TB disk, Samsung 850 EVO 2TB disk. Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2015 Share Posted May 19, 2015 ^If you had bothered reading the topic, you'd already see that I said that… relying on fopen is also a generally bad idea as many hosts set allow_url_fopen to false and direct you to utilize curl. Link to comment Share on other sites More sharing options...
NoMoreFury Posted May 19, 2015 Author Share Posted May 19, 2015 still Ineeded ipboard,ETS2mp Status Hook for ipboard ;( MY IN-Game Status Is: Feel Free to Add me on Steam My pc specs (Updated) [url=https://valid.x86.fr/212q0h][img]https://valid.x86.fr/cache/banner/212q0h-5.png[/img][/url] Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2015 Share Posted May 19, 2015 Pro tip: google is a really great resource: https://www.google.no/search?q=ipb+add+custom+page&ie=utf-8 Link to comment Share on other sites More sharing options...
Scar Posted June 20, 2015 Share Posted June 20, 2015 Closed and moved to archive due to inactivity. Scar | Retired Legend You can design and create, and build the most wonderful place in the world. But it takes people to make the dream a reality. Banned: HELP! - Report a player - Help - Rules - Staff recruitment - Complaints/feedback Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.