Monitor for PlayStation 5 in stock (Norway)

Requirements

  • PHP (cli)
    • Developed on PHP 7.4, not sure if PHP 8.x will... maybe work.
  • PHP extension: php-xml
  • PHP extension: php-curl
  • Composer
    • Other PHP extensions may also be necessary to install. Composer will likely complain when you run composer install.
  • Environment variables

Usage

Call php PS5Monitor.php via a cronjob. Every 15 minutes is probably often enough.

If you want to disable scraping of a specific store (e.g. OBS, because they overprice it quite a bit), there's a $methods array at the bottom of the script. Just comment the necessary line.

Supported stores

  • Power
  • OBS
  • MaxGaming
  • Elkjøp
  • NetOnNet
    • NetOnNet has a secondary handler where it "searches" for PlayStation 5 on their store and then tries to find any alternative listings. This can sometimes be very hit or miss.

Test mode

If you wish to test the script to make sure all stores work (e.g. API still works, scraping & parsing still works), specify any parameter after the script name: php PS5Monitor.php 123

Test mode will do the following:

  • Scrape/fetch extra test products that are assumed to be in stock.
  • Only Discord ping the first user specified in DISCORD_PING_USER_IDS.

You might want to do a search in the code for $this->isTesting to see if all the product IDs/URLs used are actually in stock, in case you notice a store failing.

Environment variables

  • PS5_WEBHOOK - Discord webhook for notifications
  • DISCORD_PING_USER_IDS - Comma-separated list of Discord user IDs that will be mentioned via the webhook message.
    • Example: 81332863928119296,414489310814011392,635912849440505886
Description
Monitor for PlayStation 5 in stock (Norway). Written back when PS5s were constantly out of stock.
Readme 50 KiB
Languages
PHP 100%