Which is the correct use:
Thanks for the opportunity of being here?
Thanks for the opportunity to be here?
The idea was to use the verb in infinitive.
I find both to be possible, but "opportunity to be here" sounds more natural to me.
Note that there isn't a general rule: it depends entirely on the particular word that governs it (here, opportunity), and there is no logic to which word prefers which construction: they just have to be learnt.