试图从facebook api中保护个人资料img。这段代码将得到url/downloadlink,但现在我想把它保存在服务器上的某个地方,这样我就可以把它从数据库中取出并显示在某个地方。我想我可能需要 php copy
但我不确定。我也已经在google上搜索过了,但那是facebook api的旧版本。
$oAuth2Client = $FB->getOAuth2Client();
if (!$accessToken->isLongLived())
$accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
$response = $FB->get("/me?fields=id, first_name, last_name, email,gender,link, birthday,picture.type(large)", $accessToken);
$userData = $response->getDecodedBody();
$fb_foto_url = $userData['picture']['data']['url'];
$voornaam= $app->get_klant_fb($userData['first_name']);
$_SESSION['voornaam'] = $userData['first_name'];
$_SESSION['achternaam'] = $userData['last_name'];
$fb_fotoUrl = $app->saving_fb_foto($userData['picture']['data']['url']);
//data ophalen
$klant= $app->get_klant_fb($userData['id']);
if($klant['id'] > 0) {
//sessie klant zetten
$_SESSION['klant_id'] = $klant['id'];
} else {
//klant aanmaken
unset($query);
$query['oauth_uid'] = $userData['id'];
$query['ledenpagina_id']= $_SESSION['ledenpagina_id'];
$query['voornaam'] = $userData['first_name'];
$query['achternaam'] = $userData['last_name'];
$query['emailadres'] = $userData['email'];
$query['geboortedatum'] = $userData['birthday'];
$query['gender'] = $userData['gender'];
$query['link'] = $userData['link'];
$query['foto'] = $userData['picture']['data']['url'];
$app->insert_query('klanten', $query);
$klant= $app->get_klant_fb($userData['id']);
if($klant['id'] > 0) {
$_SESSION['klant_id'] = $klant['id'];
}
}
暂无答案!
目前还没有任何答案,快来回答吧!