Asked  1 Year ago    Answers:  5   Viewed   14 times

We have a custom facebook login which I wrote for our website sourcecodedb.com and without any changes to our code the facebook login stopped working around april 15th 2012, our twitter api also got very slow but thats another problem. This is the page users are sent to when they click the login button.

<?php
require_once('fbsdk/facebook.php');
$facebook = new Facebook(array(
  'appId' => 'xxx',
  'secret' => 'xxx',
));

  $params = array('scope' => 'read_stream, email', 'redirect_uri' => 'http://sourcecodedb.com/loggedin.php'); //parameter vi vill anv?nda fr?n facebook anv?ndare
  $loginUrl = $facebook->getLoginUrl($params);

header('Location: '.$loginUrl);
?>

And then the page that processes the login looks sort of like this, I took out some of the code.

<?php
include_once('header.php');
require_once('fbsdk/facebook.php');

$facebook = new Facebook(array(
  'appId' => 'xxx',
  'secret' => 'xxx',
));

  $fbuid = $facebook->getUser(); //Detta tar facebook användarens id från en aktiv session
  echo 'fbid: '.$fbuid.'</br>';

  if($fbuid) 
{
  $user_profile = $facebook->api('/me','GET');
        $name = $user_profile['first_name'];
        $lname = $user_profile['last_name']; 
        $fbid = $user_profile['id'];

}

This was added for debugging and always returns 0

echo 'fbid: '.$fbuid.'</br>';

Any help is appreciated!

 Answers

5

Fixed it by changing

CURLOPT_CONNECTTIMEOUT => 10

To

CURLOPT_CONNECTTIMEOUT => 60

in base_facebook.php

Thursday, April 1, 2021
 
ariel
 
5

You can make batch requests as mentioned here: https://stackoverflow.com/a/11025457/1343690

But its simple to loop through your images and publish them directly.

foreach($photos as $photo)
{
       //publish photo
}


Edit:

(regarding grouping of photos on wall)

This grouping is done by facebook automatically if some photos are uploaded into the same album.

Currently you cannot create an album in a group via Graph API - it is not supported (as of now), see this bug.

But you can do this - create an album manually, then get the album_id by-
GET /{group-id}/albums, then use the the code with album_id instead of group_id-

foreach($photos as $photo){
   $facebook->api("/{album-id}/photos", "POST", array(
      'access_token=' => $access_token,
      'name' => 'This is a test message',
      'url' => $photo
      )
   );
}

I've tested it, see the result-

Thursday, April 1, 2021
 
SkyNet
 
1

When the app is published, Google make a new fingerprint for your apk. Add the new fingerprint. It might work.

Tuesday, October 5, 2021
 
2

You can do it by passing the following items in the array:

'name' => "post title",
'link' => "url to the page",
'message'=> "message",
'description' => "longer description",
'picture'=>"url of the picture",
'caption' => "Another bit of text"

This removes any reliance on the FB scraper to go out to the url and scrape and parse the data.

Sunday, October 24, 2021
 
BalusC
 
2

See what all you need to do is to change some permission in facebook developer page. See the below picture make sure you too make required permission "Yes" as I did :

Monday, December 6, 2021
 
Matt
 
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share