Cannot access a certain channel via PHP script

Well, played with your code quite a bit and found that it doesn’t get past this:

while (!$done && $tries < 15) {

not sure if it is different on twitch, but at this point on another IRC server it’s expecting a reply to a ping here.