简体   繁体   English

Facebook Object API使用PHP SDK创建场所

[英]Facebook Object API create a place with PHP SDK

I'm trying to create a new app object using the Object API . 我正在尝试使用Object API创建一个新的应用程序对象。 Here's my code... 这是我的代码...

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

I'm getting this error... 我收到此错误...

OAuthException: (#100) Object Missing a Required Value: Object at URL ' http://www.mydomain.com/?id=847 ' of type 'place' is invalid because a required property 'place:location' of type 'geo_point' was not provided. OAuthException:(#100)对象缺少必需的值:URL类型为'place'的URL'http://www.mydomain.com/? id=847 '的对象无效,因为类型为'的必需属性'place:location'没有提供geo_point。

The location info should be nested in a "data" array.... 位置信息应嵌套在“数据”数组中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM