Uncaught OAuthException

Posted by Christopher 'Cj' Jesudas on Stack Overflow See other posts from Stack Overflow or by Christopher 'Cj' Jesudas
Published on 2011-06-22T06:38:42Z Indexed on 2011/06/22 8:22 UTC
Read the original article Hit count: 398

Filed under:
|

Guys please help me out with this...the error which my program gives is "Fatal error: Uncaught OAuthException: Error validating application"... My program code is :

require ("src/facebook.php");

$appapikey = '132347710178087';
$appsecret = 'e27456d003801ae145a77ab28904fca0';

$facebook = new Facebook($appapikey, $appsecret);

$user_id = $facebook->getUser();

$friends = $facebook->api('friends.get');



echo "<p>Hello <fb:name uid=\"$user_id\" useyou=\"false\" linked=\"false\" firstnameonly=\"true\"></fb:name>, you have ".count($friends)." friends";

foreach($friends as $friend){
     $infos.=$friend.",";
}

$infos = substr($infos,0,strlen($infos)-1);

$gender=$facebook->api_client->users_getInfo($infos,'sex');

$gender_array = array(); 

foreach($gender as $gendervalue){
     $gender_array[$gendervalue[sex]]++;
}

$male = round($gender_array[male]*100/($gender_array[male]+$gender_array[female]),2);
$female = 100-$male;

echo "<ul><li>Males: $male%</li><li>Females: $female%</li></ul>";

© Stack Overflow or respective owner

Related posts about php

Related posts about facebook