Social Service Error

0 votes

Hi,

I test Social Integration Service, when I test Update Facebook Status and Get Facebook Friends From Link User, I get Error message below :

In Update Facebook Status 

Fatal error: Call to undefined method com\shephertz\app42\paas\sdk\php\social\Social::getFriendList() in /home/ideabusd/public_html/guotest/app42/FBSDK_PHP/index.php on line 111

In Get Facebook Friends From Link User

Fatal error: Uncaught exception 'com\shephertz\app42\paas\sdk\php\App42BadParameterException' in /home/ideabusd/public_html/guotest/app42/FBSDK_PHP/PHP/1.2/RestClient.class.php:326 Stack trace: #0 /home/ideabusd/public_html/guotest/app42/FBSDK_PHP/PHP/1.2/SocialService.php(167): com\shephertz\app42\paas\sdk\php\connection\RestClient::post('https://api.she...', Array, NULL, NULL, 'application/jso...', 'application/jso...', '{"app42":{"soci...') #1 /home/ideabusd/public_html/guotest/app42/FBSDK_PHP/index.php(101): com\shephertz\app42\paas\sdk\php\social\SocialService->updateFacebookStatus('guo04', 'AAA is using th...') #2 {main} thrown in /home/ideabusd/public_html/guotest/app42/FBSDK_PHP/PHP/1.2/RestClient.class.php on line 326

 

This is my code(PHP)

Update Facebook Status

 

$userName = "guo04";  
$status = "AAA is using the App42 API";  
$social = $socialService->updateFacebookStatus($userName, $status);   
Print_r("userName is" . $social->getUserName()."<br/>");  
Print_r("status is" . $social->getStatus()."<br/>");  
$jsonResponse = $social->toString();  
print_r($jsonResponse);
 
Get Facebook Friends From Link User
$userName = "guo04";  
$social = $socialService->getFacebookFriendsFromLinkUser($userName); 
Print_r("<br/><br/>userName is " . $social->getUserName()."<br/>");  
Print_r("<br/>Installed is " . $social->getFriendList()->get(0)->getInstalled()."<br/>");  
Print_r("<br/>Id is " . $social->getFriendList()->get(0)->getId()."<br/>");  
Print_r("<br/>Name is " . $social->getFriendList()->get(0)->getName()."<br/>");
$jsonResponse = $social->toString();
print_r($jsonResponse);
 
Does my code wrong or I forget something ?
 
Thank you !

 

asked Mar 12, 2014 in App42 Cloud API-BaaS by guo (110 points)
recategorized Oct 24, 2014 by sushil

1 Answer

0 votes
 
Best answer

Hi,

# For update facebook status your code is giving App42 exception you need to add your code in  try-catch block and see which type of App42 exception is coming.

# For get facebook friend from link user you can use code snippet as shown below.

  $social = $socialService->getFacebookFriendsFromLinkUser($userName);
  $friendList=$social->getFriendslist();
    foreach($friendList as $response){
    print_r("Friend Name : ".$response->getName());
    print_r("Picture is : ".$response->getPicture());
   }
 
 
Note : Please put all your code in try catch block so you can easily encounter which type to App42 Exception is coming.

 

answered Mar 13, 2014 by anonymous
selected Mar 17, 2014 by guo
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...