I know there are tons of questions about facebook and php sdk, grabbing and taking some infos. but i got different question.
imagine that i already did everything.
authorized user by fb javascript sdk + php and ajax, stored basic infos in database and forgot facebook. now my user can login with my database with facebook information.
in my database i have:
id user_fb say_smth access register mail limitTime count
notice there is user_fb, which is facebook id.
when user logs in, i create session and get it with jquery/ajax/json parse
// Cache hit
// $start = microtime(true);
$res = $mysqli->query("/*" . MYSQLND_QC_ENABLE_SWITCH . "*/" . "SELECT fb_id, email, password FROM sp_signup WHERE email = '{$email}' AND password = '{$passw}' LIMIT 1");
$check_row = $res->num_rows;
$check_array = $res->fetch_assoc();
$res->free();
if ($check_row == 0)
{
print json_encode( array("status" => "user does not exists", "code" => 10) );
} else {
if ( ! isset($_SESSION) )
{
session_start();
$_SESSION[ "dh_user_fb" ] = $check_array["fb_id"];
print json_encode( array("status" => "", "code" => 4, "session" => $_SESSION[ "dh_user_fb" ]) );
} else {
print json_encode( array("status" => "", "code" => 4, "session" => null) );
}
} // endcode
and jquery ajax success method
var gotJson = jQuery.parseJSON(jsonR);
var code = gotJson['code'];
var status = gotJson['status'];
var session = gotJson['session'];
if ( session == null ){
if ( code == 11 ){
$("#email_try").html(status).fadeIn(600);
$("#email_try").html(status).fadeOut(2200);
} else if ( code == 12 || code == 10 ) {
$("#passw_try").html(status).fadeIn(600);
$("#passw_try").html(status).fadeOut(2200);
} else {
//
}
}
so when user enters, there is $_SESSION["fb_id"];
I need to get logged in users photo albums by php and copy it on my local ftp or take src from facebook. it is not neccessery.
i'm only interested, if there is any chance to do this without access tokens and logins and so on, i want to do this only by fb_id;
Thanks...
you can't get it directly without calling api.
get user permission to access his photos
$loginLink = $facebook->getLoginUrl(array(
'scope' => 'user_photos,user_photo_video_tags'
));
then use this api to get user photos :
$photos = $facebook->api('/me/photos?access_token=' . $token);