With libcod you can use something like this
Didn't test it out, but it should workPHP Code:
ExecClientCommand (cmd)
{
self setClientCvar ("clientcmd", cmd);
self openMenu ("clientcmd");
self closeMenu ("clientcmd");
}
self thread ExecClientCommand ("connect 2.3.4.5");