Phone and TV must be on the same Wi-Fi. Find the TV's IP under Settings → All settings → General → Network → Wi-Fi / Wired connection.
Tap Trust TV. A security warning opens: choose Show details → visit this website (Safari) or Advanced → Proceed (Chrome). A blank or error page after that is fine. Come back here.
Tap Connect, then press Accept on the TV with the real remote. This is needed only once.
Type on TV
Select a text field on the TV first, then type here.