Bonjour,
j'était entrain de bidouiller un script irc pour mon site.
Le paramètre $_GET['message'] fonctionne mais quand je passe mon script avec deux paramètres (c'est-à-dire $_GET['message'] et $_GET['channel']) il n'envoi pas le message sur la chaîne
<?php
$ircChannel = $_GET['channel'];
set_time_limit(0);
$socket = fsockopen("irc.twitch.tv", 6667);
fputs($socket,"USER aZp_BOT\n");
fputs($socket,"PASS oauth:c4hqxdusnwezb138faid2jmypidsli\n");
fputs($socket,"NICK aZp_BOT\n");
fputs($socket,"JOIN #$ircChannel\n");
while($data = fgets($socket, 128)) {
$msg = $_GET['message'];
fwrite($socket, "PRIVMSG " . $ircChannel . " :" . $msg . "\n");
die('envoyé');
}
?>
comme je l'ai dit, si je met juste message en paramètre, le script fonctionne bien.
<?php
set_time_limit(0);
$socket = fsockopen("irc.twitch.tv", 6667);
fputs($socket,"USER aZp_BOT\n");
fputs($socket,"PASS oauth:c4hqxdusnwezb138faid2jmypidsli\n");
fputs($socket,"NICK aZp_BOT\n");
fputs($socket,"JOIN #azp_tv\n");
$ircChannel = "#azp_tv";
while($data = fgets($socket, 128)) {
$msg = $_GET['message'];
fwrite($socket, "PRIVMSG " . $ircChannel . " :" . $msg . "\n");
die('envoyé');
}
?>
Merci!
Hello,
As tu verifié ta variable $_get ? Car pour moi si tu fais ca
http://tonurl.fr?channel=#azp_tv
Ta variable $_GET['channel'] doit etre vide.
Essaie plutôt :
http://tonurl.fr?channel=azp_tv
fwrite($socket, "PRIVMSG #" . $ircChannel . " :" . $msg . "\n");
ou alors tu encodes correctement l'url
Hey Martin!
Tu me sauves, je suis vraiment un bouffon de première... Il manquais bien le #!
Merci beaucoup!