【问题标题】:Checkin using Graph API使用 Graph API 签入
【发布时间】:2014-12-01 20:59:18
【问题描述】:

我尝试签入,来自 PHP 代码的部分:

$attachment =  array('access_token' => '$access',                        
                     'place'        => '117464364938130',
                     'message'      => 'I am place to check in',
                     'coordinates'  => array(
                              'latitude'  => '40',
                              'longitude' => '-73',)
                    );

但我得到错误:

{"error":{"message":"(#160) Invalid coordinates. Coordinates must contain at least latitude, and longitude.","type":"OAuthException","code":160}}

为什么?

【问题讨论】:

    标签: php facebook facebook-graph-api


    【解决方案1】:

    您应该将坐标编码为 JSON

    $attachment =  array('access_token'  => '$access',                        
                         'place'          => '117464364938130',
                         'message' => 'I am place to check in',
                         'coordinates' => json_encode(array(
                                            'latitude'  => '40',
                                            'longitude' => '-73')))
    

    【讨论】:

    • 我得到同样的错误:"{"error":{"message":"(#160) 无效坐标。坐标必须至少包含纬度和经度。","type":"OAuthException","code":160}}"
    • 如果尝试 40.0, -73.0 会怎样?也可以尝试作为数字,不带 ''
    【解决方案2】:

    尝试以下方法:

    $attachment =  array('access_token' => '$access',                        
                         'place' => '117464364938130',
                         'message' => 'I am place to check in',
                         'coordinates' => '{"latitude": 40, "longitude": -73}');
    

    顺便说一句,您不应该再使用Checkin 对象,否则您可能会遇到更多问题。相反,请使用Post。此外,您无需指定坐标,这将解决您的问题!也请阅读我的帖子here

    【讨论】:

      猜你喜欢
      • 2012-02-08
      • 1970-01-01
      • 1970-01-01
      • 2011-08-12
      • 2011-12-14
      • 1970-01-01
      • 2020-10-09
      • 1970-01-01
      • 2014-10-25
      相关资源
      最近更新 更多