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
Also question:
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.
Code:
<?php
$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\"?>
<LOGIC>
<song>
<songID>$songID</songID>
<artist>$artist</artist>
<title>$title</title>
<album>$album</album>
<duration>$duration</duration>
</song>
</LOGIC>";
header("Content-type: text/xml");
echo $xml;
?>
This code is almost 1:1 copied from weblogic script in this old archive:
http://support.spacialaudio.com/wiki/Im ... ebv436.zipI 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:
Code:
<?xml version="1.0"?>
<LOGIC>
<song>
<songID>10</songID>
<artist></artist>
<title>Applause</title>
<album></album>
<duration>9535</duration>
</song>
</LOGIC>
This is my config settings:
Attachment:
webscripting-settings.PNG [ 9.69 KiB | Viewed 2010 times ]
And this is how I ran the code:
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.