• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

RDJ v2.0 Web Export Text Replacing?

Started by KJ6EO, September 16, 2018, 03:08:19 AM

KJ6EO

Hi Steve.  Ok ... here is what I have:

In the Custom Data on Web Export -

xpwd=password&track-type=$track-type$&artist=$artist$&title=$title$

In the PHP Script -

define('RDJ_PASSWORD', 'password'); // RadioDJ Web Export password


In the Web Export Box, the method is POST and it's enabled.  The path to the remote PHP
script is correct.

However, it doesn't work.  I tried uncommenting the debugging lines to create the debugging files
but no TXT files are being created.  Using "tcpdump -i eth1 port 80", I can see that the RDJ box on
my LAN is sending/receiving from my Ubuntu Server.  However, I can't see the data, just that packets
are being exchanged.  Since the uncommented debugging lines aren't creating any files, I have an idea
that the PHP script is sending a "Access Denied" message.  If the xpwd isn't correct, the code jumps to
the end of the file and it responds with the "Access Denied" message.  As you can see from the code I
pasted above, the passwords are correct.  But for some unknown reason it appears that the script sends
"Access Denied" regardless of weather the password is correct or not.  Maybe the next step is to comment
out the lines of code that deal with the xpwd in the PHP file?

stevewa

try this:
1. simple. edit the php script, instead of it saying "Access Denied", make it say "xpwd did not match"
save script and try it again in web browser. if it says the new line, it is reaching the php script, running it, and failing at the match. but if it still says Access Denied, then try number 2 below


2. harder. take a look at your web server logs, maybe apache? you seem well versed in linux, so you can probably find them easily. grep the log, look for your actual url (http://www.kj6eo.com/web-export.php gave me a 404 error). Look for the http response codes in the log for that url.
if those codes relate to an "Access Denied" message, that usually means either the file ownership is incorrect, and or the file access permissions are incorrect, or the parent folder where the file lives has kicked you out for playing that awful rock music...  :D


KJ6EO

Ok ... here we go:

sudo tcpdump -nni eth1 -A src kj6eo.com and port 80 and 'tcp[13] & 8!=0'

17:56:26.403867 IP 64.183.122.11.80 > 192.168.1.27.56290: Flags [P.], seq 25:250, ack 71, win 123, length 225
E..   #@@.@..)@.z......P..c..=..3.P..{}...HTTP/1.1 200 OK
Date: Mon, 24 Sep 2018 00:56:26 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.26
Vary: Accept-Encoding
Content-Length: 31
Content-Type: text/html

Missing song artist/title/album

However, the artist/title/album information is being sent:

sudo tcpdump -nni eth1 -A src 192.168.1.27 and port 80 and 'tcp[13] & 8!=0'

17:59:17.467235 IP 192.168.1.27.56296 > 64.183.122.11.80: Flags [P.], seq 180:245, ack 26, win 16418, length 65
E..iZ   @...$.....@.z....P)...T   ..P.@"....xpwd=password&artist=Kid Rock&title=Born Free&album=&track-type=0
17:59:17.467633 IP 192.168.1.27.56297 > 64.183.122.11.80: Flags [P.], seq 4198751758:4198751938, ack 4190704039, win 16425, length 180
E...Z
@...#.....@.z....P.C......P.@)
...POST /TuneIN/web-export.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: http_requester/0.1
Host: kj6eo.com
Content-Length: 65
Expect: 100-continue

So, for whatever reason, the script is ignoring the artist/title/album information.  Therefore, nothing gets posted to TuneIN.  Not having any experience with PHP Scripts, I can't troubleshoot this script.  If someone here is well versed in PHP, I would certainly appreciate your help regarding debugging the script (download available earlier in the thread).

KJ6EO

I decided to try one last thing before calling it a night.  I know the artist/title/album information is being sent correctly.  So the Script has to be lying to me.  So, I decided to terminate it's ability to exit for (Missing song artist/title/album):

//if(empty($artist) || empty($title) || empty($album)){
//exit('Missing song artist/title/album');
//}


and guess what?  The Script works now.  Not only does it work, but it works perfectly.  Now TuneIN isn't going BIZERK when I rapid fire my TOH ID's, Jingles, etc.  I appreciate everyones help regarding getting the Script working!

stevewa

thanks for the update

actually, it appears the album information is not being sent at all, and therefore, the php script was doing what it was programmed to do, fart with an exit message "Missing song artist/title/album"

but your solution is good enough for now...

but you could either start sending the album data in the web export tab, BUT if your song metadata in RadioDJ is missing album information, the php script will still fart and exit

you could edit the php script, and remove the last portion of the IF statement
if(empty($artist) || empty($title) || empty($album))

so the edited line looks like this:

if( empty($artist) || empty($title) )

that way you really only care about the artist & title


either way, congratulations!

KJ6EO

Quote from: stevewa on September 24, 2018, 04:55:33 AM
thanks for the update

actually, it appears the album information is not being sent at all, and therefore, the php script was doing what it was programmed to do, fart with an exit message "Missing song artist/title/album"

but your solution is good enough for now...

but you could either start sending the album data in the web export tab, BUT if your song metadata in RadioDJ is missing album information, the php script will still fart and exit

you could edit the php script, and remove the last portion of the IF statement
if(empty($artist) || empty($title) || empty($album))

so the edited line looks like this:

if( empty($artist) || empty($title) )

that way you really only care about the artist & title


either way, congratulations!

Hi Steve ... I un-commented the "Missing song artist/title/album" part of the code and applied the change you mentioned above.  Yes, it works great.  I have very little album info, so that's what caused the problem.  That answers my question as to why it worked one time.  I guess a song came along that had "album" info and it posted to TuneIN.  Thanks again for your help!