<tfoot id='xslP0'></tfoot>
      <i id='xslP0'><tr id='xslP0'><dt id='xslP0'><q id='xslP0'><span id='xslP0'><b id='xslP0'><form id='xslP0'><ins id='xslP0'></ins><ul id='xslP0'></ul><sub id='xslP0'></sub></form><legend id='xslP0'></legend><bdo id='xslP0'><pre id='xslP0'><center id='xslP0'></center></pre></bdo></b><th id='xslP0'></th></span></q></dt></tr></i><div id='xslP0'><tfoot id='xslP0'></tfoot><dl id='xslP0'><fieldset id='xslP0'></fieldset></dl></div>
      • <bdo id='xslP0'></bdo><ul id='xslP0'></ul>

      <small id='xslP0'></small><noframes id='xslP0'>

      <legend id='xslP0'><style id='xslP0'><dir id='xslP0'><q id='xslP0'></q></dir></style></legend>
      1. FACEBOOK SDK v4 返回空白电子邮件地址

        FACEBOOK SDK v4 is returning blank email adress(FACEBOOK SDK v4 返回空白电子邮件地址)
        1. <legend id='N9RNg'><style id='N9RNg'><dir id='N9RNg'><q id='N9RNg'></q></dir></style></legend>

            <tfoot id='N9RNg'></tfoot>
              <tbody id='N9RNg'></tbody>

            <small id='N9RNg'></small><noframes id='N9RNg'>

              <i id='N9RNg'><tr id='N9RNg'><dt id='N9RNg'><q id='N9RNg'><span id='N9RNg'><b id='N9RNg'><form id='N9RNg'><ins id='N9RNg'></ins><ul id='N9RNg'></ul><sub id='N9RNg'></sub></form><legend id='N9RNg'></legend><bdo id='N9RNg'><pre id='N9RNg'><center id='N9RNg'></center></pre></bdo></b><th id='N9RNg'></th></span></q></dt></tr></i><div id='N9RNg'><tfoot id='N9RNg'></tfoot><dl id='N9RNg'><fieldset id='N9RNg'></fieldset></dl></div>

                  <bdo id='N9RNg'></bdo><ul id='N9RNg'></ul>
                • 本文介绍了FACEBOOK SDK v4 返回空白电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 facebook sdk v4,但我似乎无法获得电子邮件地址.这是我的代码.我已经搜索了互联网上的每一个链接并尝试了每一件事.还尝试了不同的脚本,但我仍然收到空电子邮件.这是我的代码.

                  I'm using facebook sdk v4 and i can't seem to get the EMAIL ADDRESS. Here is my code. I have searched each and every link on internet and tried every thing. Also tried different scripts but still i'm getting null email. Here is my code.

                  /* INCLUSION OF LIBRARY FILEs*/
                      require_once( 'lib/Facebook/FacebookSession.php');
                      require_once( 'lib/Facebook/FacebookRequest.php' );
                      require_once( 'lib/Facebook/FacebookResponse.php' );
                      require_once( 'lib/Facebook/FacebookSDKException.php' );
                      require_once( 'lib/Facebook/FacebookRequestException.php' );
                      require_once( 'lib/Facebook/FacebookRedirectLoginHelper.php');
                      require_once( 'lib/Facebook/FacebookAuthorizationException.php' );
                      require_once( 'lib/Facebook/GraphObject.php' );
                      require_once( 'lib/Facebook/GraphUser.php' );
                      require_once( 'lib/Facebook/GraphSessionInfo.php' );
                      require_once( 'lib/Facebook/Entities/AccessToken.php');
                      require_once( 'lib/Facebook/HttpClients/FacebookCurl.php' );
                      require_once( 'lib/Facebook/HttpClients/FacebookHttpable.php');
                      require_once( 'lib/Facebook/HttpClients/FacebookCurlHttpClient.php');
                  
                  /* USE NAMESPACES */
                  
                      use FacebookFacebookSession;
                      use FacebookFacebookRedirectLoginHelper;
                      use FacebookFacebookRequest;
                      use FacebookFacebookResponse;
                      use FacebookFacebookSDKException;
                      use FacebookFacebookRequestException;
                      use FacebookFacebookAuthorizationException;
                      use FacebookGraphObject;
                      use FacebookGraphUser;
                      use FacebookGraphSessionInfo;
                      use FacebookFacebookHttpable;
                      use FacebookFacebookCurlHttpClient;
                      use FacebookFacebookCurl;
                  
                  /*PROCESS*/
                  
                      //1.Stat Session
                       session_start();
                  
                      //check if users wants to logout
                       if($_REQUEST['logout']==1){
                          unset($_SESSION['fb_token']);
                       }
                  
                      //2.Use app id,secret and redirect url 
                      $app_id = 'xxxxxxxxxx';
                      $app_secret = 'xxxxxxxxxxxxxxx';
                      $redirect_url='http://someurl.com/';
                  
                      //3.Initialize application, create helper object and get fb sess
                       FacebookSession::setDefaultApplication($app_id,$app_secret);
                       $helper = new FacebookRedirectLoginHelper($redirect_url);
                       $sess = $helper->getSessionFromRedirect();
                  
                      //check if facebook session exists
                      if(isset($_SESSION['fb_token'])){
                          $sess = new FacebookSession($_SESSION['fb_token']);
                      }
                  
                      //logout
                      $logout = 'http://dryvr.co/fb/?logout=1';
                  
                      //4. if fb sess exists echo name 
                          if(isset($sess)){
                              //store the token in the php session
                              $_SESSION['fb_token']=$sess->getToken();
                              //create request object,execute and capture response
                              $request = new FacebookRequest($sess,'GET','/me');
                              // from response get graph object
                              $response = $request->execute();
                              $graph = $response->getGraphObject(GraphUser::classname());
                              // use graph object methods to get user details
                              $name = $graph->getName();
                              $id = $graph->getId();
                              $image = 'https://graph.facebook.com/'.$id.'/picture?width=300';
                              $email = $graph->getProperty('email');
                              echo "hi $name <br>";
                              echo "your email is $email <br><Br>";
                              echo "<img src='$image' /><br><br>";
                              echo "<a href='".$logout."'><button>Logout</button></a>";
                          }else{
                              //else echo login
                              echo '<a href="'.$helper->getLoginUrl(array('email')).'" >Login with facebook</a>';
                          }
                  

                  我使用了 $email = $graph->getProperty('email'); 但我仍然无法访问电子邮件地址并且它返回空白电子邮件.我该怎么办?想法?

                  I have used $email = $graph->getProperty('email'); but still I can not access the email address and it is returning blank email. What should I do? Thoughts?

                  推荐答案

                  在这里看看我的回答:

                  • 如何从 Facebook API 版本 v2.4 获取用户电子邮件和生日

                  您需要指定要从 v2.4 开始的 Graph API 返回的每个字段,例如

                  You need to specify each field you want returned from the Graph API starting with v2.4, e.g.

                  $request = new FacebookRequest($sess,'GET','/me?fields=id,name,email');
                  

                  这一切都在 Facebook 文档中.

                  It's all in the Facebook docs.

                  这篇关于FACEBOOK SDK v4 返回空白电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <bdo id='63m4U'></bdo><ul id='63m4U'></ul>

                        <tbody id='63m4U'></tbody>

                        • <i id='63m4U'><tr id='63m4U'><dt id='63m4U'><q id='63m4U'><span id='63m4U'><b id='63m4U'><form id='63m4U'><ins id='63m4U'></ins><ul id='63m4U'></ul><sub id='63m4U'></sub></form><legend id='63m4U'></legend><bdo id='63m4U'><pre id='63m4U'><center id='63m4U'></center></pre></bdo></b><th id='63m4U'></th></span></q></dt></tr></i><div id='63m4U'><tfoot id='63m4U'></tfoot><dl id='63m4U'><fieldset id='63m4U'></fieldset></dl></div>
                          <legend id='63m4U'><style id='63m4U'><dir id='63m4U'><q id='63m4U'></q></dir></style></legend>

                            <small id='63m4U'></small><noframes id='63m4U'>

                            <tfoot id='63m4U'></tfoot>