json - Facebook Graph - getting the Facebook ID - using PHP -
i have form in post facebook url.
i process url in php script facebook id.
form:
<form name="input" method="post" action="<?=($_server['php_self'])?>"> <input name="url" required> <input type="submit" value="submit">
php script
$url = $_request["url"]; $jsonurl = 'http://graph.facebook.com/'.$url.'.json'; $json = file_get_contents($jsonurl,0,null,null); $json_output = json_decode($json); $fbid = ($json_output->id); echo $fbid;
i've not been able pull in id. i'm echoing nothing.
the url be:
$jsonurl = 'http://graph.facebook.com/'.$url;
...while $url must graph api endpoint or vanity url available in public, without access token. no ".json" required.
for example:
$url = 'bladauhu'; $json_result = file_get_contents('http://graph.facebook.com/'.$url); $json = json_decode($json_result); echo $json->id;
Comments
Post a Comment