unknown_b
unknown_b

Reputation: 172

Facebook Graph Api - writing new lines in PHP

I'm getting an event using Facebook Graph API and PHP using the following code:

$id = '160307307413666';
$FBpage = file_get_contents('https://graph.facebook.com/'. $id);
$FBdata = json_decode($FBpage);
echo $FBdata->description;

The problem is when using json_decode($FBpage); i loose all the /n (new line) that i would like to render.

Any help would be appreciated

Upvotes: 0

Views: 458

Answers (2)

maxjackie
maxjackie

Reputation: 23292

use this function nl2br which will convert all new lines \n to <br/> tag

Upvotes: 1

Darvex
Darvex

Reputation: 3644

i assume you're looking for

echo '<pre>';
echo $FBdata->description;
echo '</pre>';

Upvotes: 5

Related Questions