Not sure, but there are two things that caught my eye when comparing with the old SAM 4.3.6 web template that still included a sample web logic module:
#1 You pass the XML namespace to the root LOGIC element, that is not there in the original code.
#2 You're missing the <?xml ?> doctype/namespace tag
Are you sending the right content-type? SAM expects text/xml. I know application/xml is also pretty common in XMLRPC, but I think SAM/Delphi/whatever Delphi XML library SAM uses is fixed on that one content-type and doctype. Submitting a newer doctype might confuse the hell out of it.
$link = mysqli_connect("p:localhost","root","root", "SAMDB");
$res = mysqli_query($link, "SELECT * FROM songlist ORDER BY date_played DESC LIMIT 1");
$row = mysqli_fetch_array($res);
$songID = htmlspecialchars($row["ID"]);
$artist = htmlspecialchars($row["artist"]);
$title = htmlspecialchars($row["title"]);
$album = htmlspecialchars($row["album"]);
$duration = $row["duration"];
$xml = "<?xml version=\"1.0\"?>
This code is almost 1:1 copied from weblogic script in this old archive: http://support.spacialaudio.com/wiki/Im ... ebv436.zip
I adjusted the commands to use mysqli instead of mysql as that's no longer in PHP7 and made it pick a random instead of the least recently played track (because in my library that will always result in one of the sound effects for a very long time as they are significantly underplayed - read: 0 playcount against the rest of my library)
Seems to work just fine for me.
The actual output looks like this:
This is my config settings:
webscripting-settings.PNG [ 9.69 KiB | Viewed 2002 times ]
And this is how I ran the code:
λ php -S 0.0.0.0:8000 weblogic.choose.php
PHP 7.2.10 Development Server started at Sat Dec 15 00:42:07 2018
Listening on http://0.0.0.0:8000
Document root is C:\Users\benedikt\Desktop
Press Ctrl-C to quit.