@cheekycroak - here's an alternative for handling requests -
The url that SamPHPweb uses is this -
Code:
http://${serverIp}:${samPort}/req/?songID=${songId}&host=${host}
serverip - the ip of the server/computer the software is running on
samPort - the port SAM requests is listening on (default 1221)
songID - id of the song requested
host - ip of the request.headers.origin (must be whitelisted in SAM)
We do not use either SAM's php or html files. Here's what we did -
Connect express server to website to handle requests.
Capture songid of chosen song - pass it to the express server
Use ssl proxy from express to SAM (we use Quadrastatic), whitelist the Quadrastatic URL in SAM.
works like a charm.
The only issue we really had was that the request response from SAM is XML, not JSON, so we had to do a little XML->JSON parsing for the frontend response code/message contained in the XML to tell the user the proper information (error or success)