Freddy,
Thank you for your reply. I modified the script as you suggested, and as a second run I removed the variable entirely, as shown below:
fwrite($fp, “JOIN “.$chan.”\r\n”) or die ("Could not join channel ".$chan);
fwrite($fp, “PRIVMSG “.$chan.” Hi everyone\r\n”);
fwrite($fp, “PRIVMSG “.$chan.” Bye everyone.\r\n”);
fwrite($fp, “JOIN #shadow_4_it\r\n”) or die ("Could not join channel ".$chan);
fwrite($fp, “PRIVMSG #shadow_4_it :Hi everyone\r\n”);
fwrite($fp, “PRIVMSG #shadow_4_it :Bye everyone.\r\n”);
Unfortunately, both trials (and some other combinations and escaping attempts) were unsuccessful at writing to the chat, and I still cannot see my bot as a user in the chat. Any other suggestions?