This script isn’t really suitable for that use case.
It’s an example that will demonstrate how to take that and use it for your own means.
To spit it out into a website, you generally wouldn’t directly do an API call like this.
The Website would load from a database or other memory. Rather than making an API call each time.
So this script could be used as a cronjob to populate a database.
And your webpage that generates the iFrames would load from that database.
Howevery you could modifiy this script to output HTML instead. So just do that.