Jump to content

TheP4ck

Early Birds
  • Posts

    1
  • Joined

  • Last visited

Posts posted by TheP4ck

  1. On 6/25/2016 at 7:28 AM, Tom said:

    Hi survivors,

    With version 243.0 the devs implemented the new feature to receive web notifications. It is already implemented here in the forum, but can also be used for private servers. In this tutorial I will show you how to do it.

    1) Prepare game server for notifications

    • Make sure you add "-webalarm" to the command line of your start script. If you are running a hosted server with g-portal, nitrado etc. you have to wait until they implement the feature
    • Secondly, you have to create the AlarmPostCredentials.txt file in the /ShooterGame/Saved/ folder

    2) Security key and listening script

    • The previously mentioned text file must contain two lines
    • First line has a security key which is optional to use in the listening script, but required to have it in the text file, no matter what it looks like. It can be even "aspojasd" if you want
    • Second line specifies the URL where your listening script is stored, waiting and ready to receive the post information by your game server

    Example file then would look like this:

    
    Th4t5my53cr3tC0d3!
    http://myurl.com/my_ark_script.php
    • Now you need to setup a script that is able to work with the following HTTP POST which will be send URLencoded:
    • key=Th4t5my53cr3tC0d3!&steamid=76545465465498489489&notetitle=Example%2BTitle&message=Example+Message
    • The message and title are URL encoded, so make sure to decode them in your script

    3) Example script

    As there is no general solution how to deal with the notifications, as you guys all have a different set up for server, database etc, i will just provide you an example script which you can use to modify it further:

    
    <?php
    if($_POST["key"] && $_POST["steamid"] && $_POST["notetitle"] && $_POST["message"]) 
     {
     $key = urldecode($_POST["key"]);
     $steamid = urldecode($_POST["steamid"]);
     $title = urldecode($_POST["notetitle"]);
     $message = urldecode($_POST["message"]);
     
     if ($key == "Th4t5my53cr3tC0d3!")
     {
     // Here you can do anything now, since the code is correct and everything else is provided, too.
     }
     else
     echo "Invalid key";
     } 
    else
     echo "Invalid request";
    ?>

    With that script you are now basically able to do nearly anything. You could think of sending your members an e-Mail or chat message in your forum. You could go even further and send them a whatsapp message or anything else, as long as you have implemented the needed API and you are able to link the user's steam ID with an email, cellphone number etc.

    Enjoy :-)

    Tom

     

     

×
×
  • Create New...