How to import photos from Facebook?

后端 未结 5 1469
渐次进展
渐次进展 2021-01-13 06:33

I noticed when I visit photo printing websites, they ask you if you would like to import your photos from Facebook. How do they do it? Does Facebook provide API to import us

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-13 07:06

    /**
       * get_albums()
       *
       * @param long $uid
       * @return array
       */
        function get_albums($uid=null)
        {
             if (empty($uid))
                $uid = $_REQUEST['fb_sig_user'];
            try
            {
                return $facebook->api_client->photos_getAlbums($uid,null);
            }
            catch (FacebookRestClientException $ex)     
            {
                return array();
            }
        }
    
    /**
     * get_photos()
     *
     * @param bool $bool_pids
     * @param mixed $aids (array of album ids or null)
     * @return array
     */
     function get_photos($bool_pids=true, $aids=null, $pids=null)
     {
        try
        {
          $p = $facebook->api_client->photos_get(null, $aids, $pids);
        }
        catch (FacebookRestClientException $ex) { }
    
        if ($bool_pids)
        {
                $pids = array();
                if (!empty($p))
                foreach($p as $p0)
                        $pids[] = $p0['pid'];
                return $pids;
        }
        else
                return $p;
     }
    

提交回复
热议问题