Facebook对象API使用PHP SDK创建一个位置


Facebook Object API create a place with PHP SDK

我正在尝试使用object API创建一个新的应用程序对象。这是我的密码。。。

$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类型为"place"的"无效,因为类型为"geo_point"的必需属性"place:location"不是假如

位置信息应该嵌套在"data"数组中。。。。

$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']
        ]
    ])
]);