agam360 -1 Light Poster

I'd like to know if there is a simple way of retrieving the Cover photo from a user in my application, via the facebook php sdk.

I managed to retrive the cover photo id of the album of the cover photo album, but my solution only works partially.(As you can see, it's not efficient, and If more albums will be added, and moved to other pages, thus this will not work).

$albums = $facebook->api('/me/albums','GET');
    for($i = 0;$i<count($albums['data']);$i++){
        for($j = 0;$j<count($albums['data'][$i]);$j++){
            if($albums['data'][$i]['name'] == "Cover Photos"){
                echo $facebook->api('/me/albums/'.$albums['data'][$i]['cover_photo'],'GET');
            }
        }
    }

Thanks in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.