Michael Mikhjian
Michael Mikhjian

Reputation: 2794

Issue with Facebook OG / Game

I've got a game, when a user "solves" a "word" it should call the OG req.

Here's the call:

curl -F 'access_token=abc' \
     -F 'tw=theword_solved_goes_here' \
     -F 'word=https://drawabble.com/og/word.php' \
     -F 'scrape=true' \
        'https://graph.facebook.com/me/drawabble:solve'

And the object's url is - https://drawabble.com/og/word.php?&tw=theword_solved_goes_here

and the page script looks like this (word.php)

<?
    if( $_GET['fb_action_ids'] ){
        header("Location: http://drawabble.com");
    }
?>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
      xmlns:fb="https://www.facebook.com/2008/fbml"> 
 <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# drawabble: http://ogp.me/ns/fb/drawabble#">
  <meta property="fb:app_id"          content="360199164024147" /> 
  <meta property="og:type"            content="drawabble:word" /> 
  <meta property="og:title"           content="<?=($_GET['tw'])? $_GET['tw'] : $_POST['tw']?>" /> 
  <meta property="og:url"               content="https://drawabble.com/og/word.php?tw=<?=($_GET['tw'])? $_GET['tw'] : $_POST['tw']?>" /> 
  <meta property="og:description"     content="Solved on http://drawabble.com" /> 
  <meta property="og:image"           content="https://drawabble.com/drawabble.png" /> 
  <meta property="drawabble:tw"   content="<?=($_GET['tw'])? $_GET['tw'] : $_POST['tw']?>" /> 
</html>

The error is {"error":{"type":"Exception","message":"Object at URL 'https://drawabble.com/og/word.php?tw=' of type 'drawabble:word' is invalid because a required property 'og:title' of type 'string' was not provided."}}

So I'm assuming the tag's are not catching the posted or _get urls... can't figure out why.

Any help is appreciated!

Upvotes: 1

Views: 394

Answers (1)

Tom Waddington
Tom Waddington

Reputation: 1956

In your cURL call, the URL provided is https://drawabble.com/og/word.php

Now, if you scrape that, the og:title is a blank string, since we're not passing a tw get param along. We're passing a tw variable to Facebook, but that won't pass along to your app in the code you posted.

So, try changing the cURL call to...

curl -F 'access_token=abc' \
     -F 'word=https://drawabble.com/og/word.php?tw=theword_solved_goes_here' \
     -F 'scrape=true' \
        'https://graph.facebook.com/me/drawabble:solve'

Upvotes: 1

Related Questions