Well, if you keep receiving the same string each time, you can just search the message for it. If it's found, exit the script. Otherwise, continue. Got more than one string? Add them to an array and look for each string.
Or, you can just restrict your posts to the first 127 characters, all 7-bit characters, of the English language. If it's not a-zA-z0-9 or space or \n, then the message needs to be filtered.
Now, both of these are simple RegEx ([man]ereg/man or [man]eregi/man) searches. If you use the latter solution, you'd need to take into account signatures, links, and other characters to allow. You can find the what the first 127 characters are here at Lookuptables.com. You can use that information to even do a character code reference and if it's between 127 and 255, reject the message. But then it limits who can post. Only english words, or english equivalents (e in place of the umlauted letter where is replaced with the letter without the umlaut) would be allowed. This would severly cut down on your posting base. But it's an option.