Not sure
This should work for you, but it doesn't do exactly what you are looking for:
https://ubbdev.com/ubb/ultimatebb.php?ubb=get_topic;f=20;t=000686
This is the one you are looking for, but it hasn't been updated for v6+
https://ubbdev.com/ubbcgi/ultimatebb.cgi?ubb=get_topic;f=7;t=000403
I'll look and see if I can't update it, as I was thinking about this one too