Backslashses are inserted before certain characters when my bot replies

When building a bot in PHP, you may find that responses from your bot contain backslashes before quotation marks and that backslashes you do place in the reply are doubled.

PHP has a feature called Magic Quotes that can automatically escape form data to prepare it for saving in a database. To solve this problem with your code, either turn off Magic Quotes, or use the stripslashes() function to safely unescape the form post variables you receive.

You can read more about Magic Quotes, including how to turn them off, why they are being removed from PHP in the next release, and other solutions for escaping form posts in the PHP documentation on Magic Quotes.