This function used to work for me until the other day when facebook decided to enforce some changes.
function get_facebook_cookie() { $app_id
it's because facebook change cookie name from fbs_ to fbsr_.
fbs_
fbsr_
But there was more changes. Just follow this steps