Skip to Content
It is currently April 20th, 2019, 2:23 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: January 18th, 2019, 6:05 am 
Offline
Senior User
Senior User

Joined: September 7th, 2018, 9:00 am
Posts: 87
How should I call SAM on port 1221 directly?
I tried in this way but unsuccessfully

http://MYIP:1221?songID=10189


P.S. "MYIP" is put just for privacy. In the reality there is the IP of SAM Server


Top
 Profile  
Reply with quote  
PostPosted: January 18th, 2019, 7:46 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7821
Location: Aachen (Germany)
Depends on what you want to query?
SAM does at least two (probably there are more options I just forgot about) things on Port 1221, so you will need to differentiate the URL.
/event is for PAL event hooks
/req is for requests

This is how the URL format looks in the code.request.php:
Code:
"GET /req/?songID=$songID&host=" . urlencode($host) . " HTTP\1.0\r\n\r\n

So the /req/ endpoint expects 2 parameters: songID and host
songID should be an integer and host is either an IP or a hostname in URLencoded foprmat.

Your URL should look like this:
http://MYIP:1221/req/?songID=10189&host ... stname.com

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 18th, 2019, 8:37 am 
Offline
Senior User
Senior User

Joined: September 7th, 2018, 9:00 am
Posts: 87
Mastacheata wrote:
Depends on what you want to query?
SAM does at least two (probably there are more options I just forgot about) things on Port 1221, so you will need to differentiate the URL.
/event is for PAL event hooks
/req is for requests

This is how the URL format looks in the code.request.php:
Code:
"GET /req/?songID=$songID&host=" . urlencode($host) . " HTTP\1.0\r\n\r\n

So the /req/ endpoint expects 2 parameters: songID and host
songID should be an integer and host is either an IP or a hostname in URLencoded foprmat.

Your URL should look like this:
http://MYIP:1221/req/?songID=10189&host ... stname.com



Excellent, I did try it and it works.
The important is that the calling IP (the one of the server that calls) is into
Config > Request Policy > Only accept requests from these IP addresses

Thanks a million


Top
 Profile  
Reply with quote  
PostPosted: January 18th, 2019, 1:56 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7821
Location: Aachen (Germany)
But make sure to also include the hostname/IP of whoever you're making the request for. Or disable the "The same viewer can vote [aa] times every [bb] minutes, but no more than [cc] times per day." rule in your request policy.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: February 22nd, 2019, 9:48 am 
Offline
New User
New User

Joined: February 14th, 2019, 10:24 pm
Posts: 1
Mastacheata wrote:
Depends on what you want to query?
SAM does at least two (probably there are more options I just forgot about) things on Port 1221, so you will need to differentiate the URL.
/event is for PAL event hooks
/req is for requests

This is how the URL format looks in the code.request.php:
Code:
"GET /req/?songID=$songID&host=" . urlencode($host) . " HTTP\1.0\r\n\r\n

So the /req/ endpoint expects 2 parameters: songID and host
songID should be an integer and host is either an IP or a hostname in URLencoded foprmat.

Your URL should look like this:
http://MYIP:1221/req/?songID=10189&host ... stname.com

Thanks. It tried and it works.

_________________
geometry dash lite, spanish dictionary online


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group