Reputation: 2290
I try to get venues by foursquare api. The steps that I tried are:
this is the code that I try to used but it didn't work:
require_once("Api_Foursquare_EpiCurl");
require_once("Api_Foursquare_EpiFoursquare");
require_once("Api_Foursquare_EpiSequence");
$fsObj = new EpiFoursquare($clientId, $clientSecret, $accessToken);
$venue = $fsObj->get('/venues/search', array('ll' => "{$myLat},{$myLng}"));
In particular I didn't understand the functionality of the callback that I set up in the registration. Thanks!
Upvotes: 1
Views: 1741
Reputation: 1709
I got it to work with this:
$consumer_key = 'YOURS';
$consumer_secret = 'YOURS';
//Includes the foursquare-asyc library files
require_once('EpiCurl.php');
require_once('EpiSequence.php');
require_once('EpiFoursquare.php');
try{
$foursquareObj = new EpiFoursquare($consumer_key, $consumer_secret);
$venue = $foursquareObj->get('/venues/search',array('ll'=>'{your-lat},{your-long}'));
var_dump($venue);
} catch (Execption $e) {
//If there is a problem throw an exception
}
dumps out expected loc data from 4Square.
I'm using January 06, 2011 vers of EpiCurl, EpiSequence, and February 25, 2011 ver of EpiFoursquare.
Upvotes: 1
Reputation: 6056
The call back URL is where Foursquare directs the user after they successfully authenticate with the Foursquare service. So if you're doing local development (using WAMP + php for example) set your callback address to http://localhost/YOUR_PAGE_NAME.php
So what's gonna happen is this;
Foursquare redirects and passes a token back to the external application, this token can then be used for all subsequent requests on behalf of the user
I hope this helps somewhat.
Although I notice you're probably using this tutorial - http://www.joesiewert.com/2010/04/how-to-use-the-foursquare-api-with-oauth-and-php/
Which is now out of date. Also I've found in the past couple of days the that Foursquare-async library is throwing errors for me too, and I don't know why. I've posted here for help; http://groups.google.com/group/foursquare-api/browse_thread/thread/cd258a78d8073f86/ed5ff3f9fed206ed#ed5ff3f9fed206ed
Andy
Upvotes: 1