I’m attempting to use the Facebook Graph API to import details from employees Facebook profiles into our personal website.
Fetching the JSON object from the following URI:
https://graph.facebook.com/RDTATTOOANDPIERCING
I thought that I would be able to simply convert to an array and echo the desired value. However I’m getting errors.
Here’s the code:
<?php
$facebook = json_decode(file_get_contents("https://graph.facebook.com/RDTATTOOANDPIERCING"));
echo $facebook["about"];
?>
Here’s the URL if you want to see the source being rendered:
http://www.rdtattoopiercing.com/
Thanks ahead of time!
json_decode without the second parameter will return an object, if you want an array to be returned add a second parameter TRUE
try this:
or use object instead if you don’t want to add TRUE to the second parameter
$facebook->about;