Geoloqi has support for PHP via our Geoloqi SDK PHP library. It requires 5.2.0 or later for the embedded JSON, and the cURL bindings (which are compiled by default with most installations).
Getting started is easy. All you need is an application access token, which you can get from your applications page.
Here is an example of trigger creation:
<?php
include('Geoloqi.php');
$geoloqi = Geoloqi::createWithAccessToken('YOUR_APPLICATION_ACCESS_TOKEN');
$response = $geoloqi->post('trigger/create', array(
'key' => 'powells_books',
'type' => 'message',
'latitude' => 45.523334,
'longitude' => -122.681612,
'radius' => 150,
'text' => 'Welcome to Powell\'s Books!',
'place_name' => 'Powell\'s Books'
));
echo("Response for POST trigger/create:<br>");
print_r($response);
?>
For an OAuth2 application, go to the Geoloqi Developers Site and create an application! Then take a look at this example to get started:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
require('../Geoloqi.php');
$geoloqi = new Geoloqi('YOUR API KEY GOES HERE',
'YOUR API SECRET GOES HERE',
'YOUR APP REDIRECT URI GOES HERE');
$name = 'geoloqi_auth';
if(isset($_SESSION[$name])) {
$geoloqi->setAuth($_SESSION[$name]);
}
$page = (isset($_GET['page']) ? $_GET['page'] : null);
switch ($page) {
case 'login':
$geoloqi->login();
break;
case 'logout':
$geoloqi->logout();
unset($_SESSION[$name]);
break;
}
if(isset($_GET['code'])) {
$_SESSION[$name] = $geoloqi->getAuthWithCode($_GET['code']);
}
?>
<html>
<head>
<title>Geoloqi PHP SDK OAuth Example</title>
</head>
<body>
<?php
if($geoloqi->isLoggedIn()) {
echo 'You are logged in! Your account profile is:';
echo '<pre>';
$result = $geoloqi->get('account/profile');
print_r($result);
echo '</pre>';
echo '<a href="demo_oauth.php?page=logout">Log Out</a>';
} else {
echo '<a href="demo_oauth.php?page=login">Log In</a>';
}
?>
</body>
</html>