2
votes

I am developing a small application for facebook. In my application I post content to a fan page's wall.

When the user enters a new line character the post completely ignores it. How can I solve this?

4
possible duplicate of Facebook Graph API Linebreak - bkaid
it seems every time someone finds a way, it gets closed by facebook. - bkaid
yes, very annoying. There are several of facebook's support team here on stackoverflow. Is there any way to contact them directly? - vondip
this is the best place to contact them directly: facebook.com/groups/fbdevelopers - bkaid
Thank you, I've got a feeling this is going to prove very valuable :) - vondip

4 Answers

3
votes

IF you send the following text

hello%0Aline+2

The posted message will look like

hello
line 2

Checked it right now:)

1
votes

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);
0
votes

Use html_entities, otherwise the POST request is not transferred properly.

0
votes

use \r\n without any spaces in facebook graph api then you will get line break