a simple SpaceAPI dynamic updater written in php
Find a file
2025-03-20 23:29:38 +02:00
README.md Add docs 2025-03-20 23:29:38 +02:00
spacestate.php Add docs 2025-03-20 23:29:38 +02:00

a simple SpaceAPI dynamic updater written in php

Setting up

  • Create your SpaceAPI json file and replace the template in $template. Keep this section as it is:
"state": {
        "open": $state,
        "lastchange": $timestamp,
        "message": "$message"
    }
  • Store your secret in the environment variable SPACESTATE_SECRET
  • Host spacestate.php on your favorite PHP-capable web server. You're all set.

Usage

To update spaceapi.json, make a POST request with the secret, the current space state and a message (can be empty):

curl -H 'Content-Type: application/json' \
-d '{ "secret": "012345678910","state": false,"message": "a number of hackers is certainly in the space" }' \
-X POST example.com/spacestate.php

To get the current contents of spaceapi.json, make a GET request:

curl example.com/spacestate.php