Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook user agent #6

Open
ghost opened this issue Jul 2, 2013 · 1 comment
Open

Facebook user agent #6

ghost opened this issue Jul 2, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 2, 2013

Im trying to put code to recognize facebook user agent, but im dump about php. Could someone help me?
https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content/

facebookexternalhit/1.0
facebookexternalhit/1.1

@skoskie
Copy link

skoskie commented Jul 24, 2013

You could probably go with something like this:

    function filterFacebookBot(array &$userAgent)
    {
        if('facebookexternalhit' === $userAgent['browser_name'])
        {
            $userAgent['browser_name'] = 'facebookbot';
        }
    }

    ///$ua = new ....
    $ua -> addFilter('filterFacebookBot');

It's completely untested, but should be close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant