0

我正在嘗試使用Object API創建一個新的應用程序對象。這裏是我的代碼...Facebook對象API使用PHP SDK創建一個地方

$facebook->api('/app/objects/place', 'post', [ 
    'access_token' => getFacebookAppToken(), 
    'object' => json_encode([ 
     "title" => $row['title'], 
     "image" => "http://www.mydomain.com/images/$id.jpg", 
     "url" => "http://www.mydomain.com/?id=$id", 
     "description" => $row['ShortDescription'], 
     "location:altitude" => '0', 
     "location:latitude" => $row['GeoLatitude'], 
     "location:longitude" => $row['GeoLongitude'] 
    ]) 
]); 

我得到這個錯誤...

OAuthException:(#100)對象缺少必要的值:在類型的URL 'http://www.mydomain.com/?id=847' 對象'地點'無效,因爲 所提供的類型'geo_point'所需的屬性'place:location'不是 。

回答

0

位置信息應被嵌套在一個 「數據」 數組....

$facebook->api('/app/objects/place', 'post', [ 
    'access_token' => getFacebookAppToken(), 
    'object' => json_encode([ 
     "title" => $row['title'], 
     "image" => "http://www.mydomain.com/images/$id.jpg", 
     "url" => "http://www.mydomain.com/?id=$id", 
     "description" => $row['ShortDescription'], 
     "data" => [ 
      "altitude" => '0', 
      "latitude" => $row['GeoLatitude'], 
      "longitude" => $row['GeoLongitude'] 
     ] 
    ]) 
]); 
相關問題