2012-01-24 26 views
2

當我嘗試通過我的FBApp發佈在我的牆上時,出現此錯誤。在本地主機上一切正常。在這裏我的代碼示例。Facebook post例外:(#100)鏈接URL格式不正確

$facebook = new Facebook(array( 
'appId' => API_KEY, 
'secret' => API_SECRET, 
'cookie' => true, 
)); 

$args = array(
     'message' => $_SESSION['fields']['message'], 
     'name' => 'Look at POSTCARD', 
     'caption' => $context['ProjectName'], 
     'link' => $data['view_url']."&s=".$hash, 
     'description' => 'We are a lifestyle community with hotel services in the heart of San Francisco,check us out and ask a question.', 
     'picture' => $body_all["thumb"], 
     'actions' => array(array('name' => 'SEND A POSTCARD', 
         'link' => FACEBOOK_ACTION_URL."?next_postcard_id=".$postcard_id)) 
    ); 

在這個字符串,異常PHP Fatal error: Uncaught OAuthException: (#100) link URL is not properly formatted拋出

$post_fb_id = $facebook->api("/me/feed/", "post", $args);

+0

http://apps.facebook.com/268304686540809/?view=b64baf1fe00a8927335fe417c2cbee11&s=b64baf1fe00a8927335fe417c2cbee11 –

+0

我不'噸知道爲什麼,現在一切工作不錯,但還有另外一個例外 - '有效接入令牌,必須使用查詢關於當前用戶的信息.'任何機構知道,如何解決它? –

+0

登錄Facebook之前做一個API調用 –

回答

-1

安東Sementsov 我不擅長PHP的一面,但在Java好!面對同樣的問題,代碼100
使用APP_ACCESS_TOKEN擊中URL
https://graph.facebook.com/USER_ID/feed?access_token=APP_ACCESS_TOKEN&message=JustTest&link=http//domain/path/file.jsp

使用ApacheHTTP客戶打網址,問題是,如果參數傳遞給[鏈接]被擊中URL你之前被編碼將得到錯誤代碼:100

如果在HIT之前編碼URL,則必須確保參數鏈接的值未被編碼並以相同的UTF格式傳遞。

+0

此條件也適用於https://graph.facebook.com/me/feed。 – pkm1986