Search code examples
phpfacebookfacebook-graph-api-v2.2

Why is Facebook Open Graph ignoring $_GET Method?


I have searched for hours and have come up empty. I'm sure it is something easy that I am missing but I really need help.

If you go to the link below, you will see that the video id is printed out on the page.

http://www.daystar.com/fb_opengraph_test2.php?video=123

When I load that URL into the Debugger at https://developers.facebook.com/tools/debug/og/object/ and click on "Scraped URL - See exactly what our scraper sees for your URL", I don't see the output of my GET.

Here is my basic test code:

<head>
    <title>Testing <?php echo $_GET['video'];?></title>
    <meta property="og:title" content="Facebook Open Graph META Tags"/>
    <meta property="og:url" content="http://www.daystar.com/fb_opengraph_test2.php"/>
    <meta property="og:image" content="http://www.daystar.com/wp-content/uploads/daystar-logo-1.png"/>
    <meta property="og:site_name" content="Testing"/>
    <meta property="og:description" content="This is a test"/>
</head>
<body>
<?php echo "Testing URL - video=" . $_GET['video'];?>
</body>

Please help. This has been driving me nuts all day.


Solution

  • After looking at the Apache Access log, I realized that this was a server setup error. I was getting a 301 Redirect in the log. Apparently there was a setting which causes bots to redirect such as the facebookexternalhit/1.1 bot being used by Facebook.

    Thanks for all the help. I'm leaving this Question here in case someone else has this issue.