|
Answer» I don't have the option of using fsockopen at my host, so I am wondering if there is a way to use cURL instead to connect and talk to an IRC server.
I can connect perfectly fine using this code :
Code: [Select]$url = 'irc.freenode.net'; $ch = curl_init(); $timeout = 10; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_PORT, 6667); curl_setopt($ch, CURLOPT_FAILONERROR, true); $OUTPUT = @curl_exec($ch); echo '<pre>'; print_r(curl_getinfo($ch)); print_r($output); echo '</pre>'; echo "\n\ncURL ERROR number:" .curl_errno($ch); echo "\n\ncURL error:" . curl_error($ch); curl_close($ch); That's as far as I can get. I can't work out how to send commands such as WHO, LIST ect to the server and then get the response.
Can anyone SHED some light please ? Is it even possible ?I don't think it would work. SIMPLY because cURL with close the connection as soon as the script ends, and you want it to stay alive until you want to log out. I don't need to maintain a connection. All I need to do is connect, get a list of people in the room and then leave.
Thanks for the reply Looks like I stumped the experts then No, you just stumped the IRC and PHP developers. Hmm read 187 times....I guess it can't be done.
|