1

I try to checkin, the part from the PHP code:

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

but I get error:

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

why?

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
Idan Neeman
  • 119
  • 1
  • 1
  • 8

2 Answers2

0

You should encode the coordinates as JSON

$attachment =  array('access_token'  => '$access',                        
                     'place'          => '117464364938130',
                     'message' => 'I am place to check in',
                     'coordinates' => json_encode(array(
                                        'latitude'  => '40',
                                        'longitude' => '-73')))
Aviram Segal
  • 10,962
  • 3
  • 39
  • 52
  • I get the same error: "{"error":{"message":"(#160) Invalid coordinates. Coordinates must contain at least latitude, and longitude.","type":"OAuthException","code":160}}" – Idan Neeman Dec 16 '12 at 10:51
  • What if you try 40.0, -73.0 ? also try as numbers, without '' – Aviram Segal Dec 16 '12 at 11:59
0

Try the following:

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

By the way, you shouldn't use the Checkin object anymore or you might meet some more problems. Instead, use Post. Moreover, you won't need to specify the coordinates, which will solve your problem anyway! Please also read my post here.

Community
  • 1
  • 1
Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130