Esempio n. 1
0
if (!function_exists('json_decode')) {
    throw new Exception('yelp-api-php needs the JSON PHP extension.');
}
///////----------- SENCHA PROXY FRIENDLY
//Retrieve the arguments from Ext.data.JsonP.request()
$callbackkey = filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_ENCODED);
$consumer_key = filter_input(INPUT_GET, 'ckey', FILTER_SANITIZE_ENCODED);
$consumer_secret = filter_input(INPUT_GET, 'csecret', FILTER_SANITIZE_ENCODED);
$token = filter_input(INPUT_GET, 't', FILTER_SANITIZE_ENCODED);
$token_secret = filter_input(INPUT_GET, 'tsecret', FILTER_SANITIZE_ENCODED);
$search = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_ENCODED);
$search = urldecode($search);
$config = array('consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret, 'token' => $token, 'token_secret' => $token_secret);
// Create yelp business api driver
$yelp = new Yelp($config);
$data = $yelp->get($search);
//for example: $data = $yelp->get('business/yelp-san-francisco');
//for example: $data = $yelp->get('search?term=food&location=San+Francisco');
//Wrap it in the callback key
if ($callbackkey) {
    echo $callbackkey . '(' . $data . ');';
} else {
    echo $data;
}
///////----------- SENCHA PROXY FRIENDLY
/**
 * Base yelp exception class.
 */
class YelpException extends Exception
{
}