2012-04-03 123 views
1

我有一個遊戲,當用戶「解決」一個「單詞」它應該調用OG req。問題與Facebook OG /遊戲

這裏的電話:

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' 

和對象的網址是 - https://drawabble.com/og/word.php?&tw=theword_solved_goes_here

和網頁腳本看起來像這樣(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> 

的錯誤是{」錯誤「:{」type「:」Exception「,」message「:」Object at URL'https://drawabble.com/og/word.php?tw='''drawabble:word''類型是無效的,因爲需要'string'類型的屬性'og:title'不是pro 「}}

所以,我假設標籤沒有捕獲張貼或_get網址...不知道爲什麼。

任何幫助表示讚賞!

回答

1

在您的通話捲曲,所提供的網址爲https://drawabble.com/og/word.php

現在,如果你刮的是,OG:標題是一個空字符串,因爲我們沒有通過沿TW GET PARAM。我們將一個tw變量傳遞給Facebook,但這不會傳遞到您發佈的代碼中的應用程序。

因此,嘗試改變捲曲呼叫...

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'