Attempting to pull session stats data from the xml at :32400/status/sessions?X-Plex-Token= gives a 401 unauthorized error when running a script from the same machine.
I’ve tried with file_get_contents in this php script and also tried using curl from the command line. Curl gives the 401 error using both localhost and 127.0.0.1, but properly reads using the device IP address, but any attempts at alternatives to file_get_contents in the script so far haven’t worked.
My understanding is that there is some security built into plex that prevents access to scripts through localhost, but I’m no network engineer so I’m not sure the best way to work around this for this particular script.