facebook Graph API post to wall doesn't accept new line
I am developing a small application for facebook. In my application I post content to a fan page's wall.
When the user 开发者_如何学Centers a new line character the post completely ignores it. How can I solve this?
IF you send the following text
hello%0Aline+2
The posted message will look like
hello
line 2
Checked it right now:)
this work fine for me:
// first: replace normal \n (or "\\n") for "\r\n"
$mensaje=str_replace("\\n","\r\n",$reg['mensaje']);
// second: this only is for clear special characters
$mensaje=utf8_encode($mensaje);
Use html_entities
, otherwise the POST request is not transferred properly.
use \r\n without any spaces in facebook graph api then you will get line break
精彩评论