Reputation: 4944
In the code below, the second line posts $comment
to Twitter.
When $comment
below has apostrophes in it, they are preceded in the Tweet with a backslash. How can I get rid of the backslash in Twitter?
$comment = mysql_real_escape_string($_POST['comment']);
$tweet->post("statuses/update", array("status" => "$comment $fullurl"));
Upvotes: 0
Views: 302
Reputation: 55009
There's no SQL visible in all of this, so there is no point in calling mysql_real_escape_string
. In fact, since you say you're posting to Twitter, I doubt there's any SQL involved at all on your side (at least not for that part).
Escaping should always be done as the very last thing, immediately before actually using the variable in an SQL statement, and only for the context of that SQL statement. If your $tweet->post
function does some SQL on your side as well, have that function do the escaping necessary.
Upvotes: 3