Exemple #1
0
<?php

require_once "../yakwala_api.class.php";
$name = array_key_exists("name", $_GET) ? $_GET['name'] : "Yakwala";
// Set your client key and secret
$client_key = "50a0e2c4fa9a95240b000001";
$client_secret = "5645a25f963bd0ac846b17eb517cd638754f1a7b";
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
if (array_key_exists("code", $_GET)) {
    $userid = "50af3cc0540c32480c000002";
    // SEARCH TAGS
    $params = array('limit' => 0, 'skip' => 0, 'sort' => 'lastUsed');
    $response = $yakwala->GetPublic("api/tag/search/no", $params);
    $taglist = json_decode($response);
    echo "<br><br> <b>TAGS SEARCH RESULTS:</b> tag/search/no<br>";
    print_r($taglist);
    // SEARCH YAKCAT
    $params = array('limit' => 0, 'skip' => 0);
    $response = $yakwala->GetPublic("api/cat/search/spor", $params);
    $catlist = json_decode($response);
    echo "<br><br> <b>YAKCAT SEARCH RESULTS:</b> cat/search/spor<br>";
    print_r($catlist);
    // SEARCH USERS
    $params = array('limit' => 0, 'skip' => 0);
    $response = $yakwala->GetPublic("api/user/search/Rebe", $params);
    $userlist = json_decode($response);
    echo "<br><br> <b>USERS SEARCH RESULTS:</b> users/search/rebe<br>";
    print_r($userlist);
    // SEARCH PLACES
<?php

require_once "../yakwala_api.class.php";
$name = array_key_exists("name", $_GET) ? $_GET['name'] : "Yakwala";
// Set your client key and secret
$client_key = "50a0e2c4fa9a95240b000001";
$client_secret = "5645a25f963bd0ac846b17eb517cd638754f1a7b";
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
if (array_key_exists("code", $_GET)) {
    // IDENTIFY USER
    $response = $yakwala->GetToken($_GET['code'], $redirect_uri);
    echo 'TOKEN' . $response->access_token;
    $yakwala->SetAccessToken($response->access_token);
    showUserBasics($response->user);
    $userid = $response->user->id;
    // POST a place
    $params = array("place" => json_encode(array("title" => 'place title3', "content" => 'place content', "yakcat" => array('50923b9afa9a95d409000', '50923b9afa9a95d409000001'), "freetag" => array('tag11', 'tag22'), "outgoinglink" => 'http://www.theplacewebsite.com', "location" => array('lat' => 48.2, 'lng' => 2.3), "formatted_address" => " 3 rue du Ruisseau, Paris , France", "address" => array("street_number" => "3", "street" => "rue du Ruisseau", "arr" => "", "city" => "Paris", "state" => "Paris", "area" => "Ile de France", "country" => "France", "zip" => "75018"), "contact" => array("tel" => "0123456789", "mobile" => "0612345678", "mail" => "*****@*****.**", "transportation" => "metro 3 station Ruisseau", "web" => "http://www.theplace.com", "opening" => "Tlj de 8h à 20h", "closing" => "dimanches et jours fériés", "specialopening" => "Nocture le jeudi de 19h à minuit"))), "picture" => "@C:\\miro.jpg;type=image/jpeg");
    $response = $yakwala->GetPrivate("api/place/" . $userid, $params, 'POST');
    echo '<br>RESULT:<br>';
    var_dump($response);
    $theplace = JSON_decode($response)->place;
    // POST an info ( in the user's feed )
    $params = array("info" => json_encode(array("title" => 'info TOTO', "content" => 'info content', "yakcat" => array('50923b9afa9a95d409000', '50923b9afa9a95d409000001'), "yaktype" => 3, "print" => '1', "freetag" => array('tag11', 'tag22'), "placeid" => array('_id' => $theplace->_id))), "picture" => "@C:\\miro.jpg;type=image/jpeg");
    $response = $yakwala->GetPrivate("api/user/feed/" . $userid, $params, 'POST');
    $insert = $response;
    echo '<br>RESULT:<br>';
    var_dump($insert);
    // POST an info ( in the user's feed )
    $params = array("info" => json_encode(array("title" => 'info DODOD', "content" => 'info content', "yakcat" => array('50923b9afa9a95d409000', '50923b9afa9a95d409000001'), "yaktype" => 3, "print" => '1', "freetag" => array('tag11', 'tag22'), "location" => array('lat' => 48.3, 'lng' => 2.4), "address" => " 3 rue du Ruisseau, Paris , France")), "picture" => "@C:\\miro.jpg;type=image/jpeg");
Exemple #3
0
<?php

require_once "../yakwala_api.class.php";
$name = array_key_exists("name", $_GET) ? $_GET['name'] : "Yakwala";
// Set your client key and secret
$client_key = "50a0e2c4fa9a95240b000001";
$client_secret = "5645a25f963bd0ac846b17eb517cd638754f1a7b";
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
if (array_key_exists("code", $_GET)) {
    // get the user id
    $response = $yakwala->GetToken($_GET['code'], $redirect_uri);
    echo 'TOKEN' . $response->access_token;
    $yakwala->SetAccessToken($response->access_token);
    $userid = $response->user->id;
    // PLACES FORM IDS
    // both parameters are working :
    $params = array('place' => urlencode(json_encode(array('50cef8f8087542a812000006', '50ceeb60cb7b8e2410000010'))));
    $response = $yakwala->GetPublic("api/place/" . $userid, $params);
    $places = json_decode($response);
    var_dump($places);
    echo "<br><br> <b>PLACES FROM IDS:</b><br>";
    foreach ($places->data as $place) {
        echo $place->title . "<br>";
    }
    // USERS PROFILE
    $response = $yakwala->GetPublic("api/user/" . $userid, $params);
    $user = json_decode($response);
    echo "<br><br> <b>USER'S PROFILE:</b><br>";
    print_r($user);
Exemple #4
0
<?php

require_once "../yakwala_api.class.php";
$name = array_key_exists("name", $_GET) ? $_GET['name'] : "Yakwala";
// Set your client key and secret
$client_key = "50a0e2c4fa9a95240b000001";
$client_secret = "5645a25f963bd0ac846b17eb517cd638754f1a7b";
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
if (array_key_exists("code", $_GET)) {
    $response = $yakwala->GetToken($_GET['code'], $redirect_uri);
    echo 'TOKEN' . $response->access_token;
    $yakwala->SetAccessToken($response->access_token);
    showUserBasics($response->user);
    $user = $response->user;
    /*
    		//PLACES
    		// SEARCH PLACES
    		$params = array('count'=>3);
    		$response = $yakwala->GetPublic("api/place/search/tit",$params);
    		$places = json_decode($response)->places;
    		//var_dump($response);
    		echo "<br><br> <b>PLACES:</b><br>";
    		foreach($places as $place){
    			echo $place->title."<br>";
    		}
    		
    		// delete a place with a restfull method 
    		$params = array('place'=>$places[0]->_id);
    		$response = $yakwala->GetPrivate("api/place/".$user->id,$params,'DELETE');
Exemple #5
0
<?php

require_once "../yakwala_api.class.php";
$name = array_key_exists("name", $_GET) ? $_GET['name'] : "Yakwala";
// Set your client key and secret
$client_key = "50a0e2c4fa9a95240b000001";
$client_secret = "5645a25f963bd0ac846b17eb517cd638754f1a7b";
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
if (array_key_exists("code", $_GET)) {
    $response = $yakwala->GetToken($_GET['code'], $redirect_uri);
    echo 'TOKEN' . $response->access_token;
    $yakwala->SetAccessToken($response->access_token);
    showUserBasics($response->user);
    $response = $yakwala->GetPrivate("api/user/" . $response->user->id);
    $userdetails = json_decode($response);
    echo "<br><br> <b>USER DETAILS:</b> user/userid<br>";
    print_r($userdetails);
    echo "<br><br> <b>USER FAVPLACE:</b>";
    foreach ($userdetails->data->favplace as $favplaceItem) {
        echo $favplaceItem->name . ' (id= ' . $favplaceItem->_id . ' )<br>';
    }
    $response = $yakwala->GetPrivate("api/user/feed/" . $userdetails->data->_id);
    $userfeed = json_decode($response);
    echo "<br><br> <b>LAST 20 INFOS POSTED:</b> user/feed/userid<br>";
    print_r($userfeed);
    $response = $yakwala->GetPrivate("api/user/search/rebe");
    $userlist = json_decode($response);
    echo "<br><br> <b>USERS SEARCH RESULTS:</b> user/search/rebe<br>";
    print_r($userlist);
<?php

require_once "../yakwala_api.class.php";
$name = array_key_exists("name", $_GET) ? $_GET['name'] : "Yakwala";
// Set your client key and secret
$client_key = "50a0e2c4fa9a95240b000001";
$client_secret = "5645a25f963bd0ac846b17eb517cd638754f1a7b";
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
// Create an account
$params = array("mail" => '*****@*****.**', "client_key" => "50a0e2c4fa9a95240b000001");
$response = $yakwala->GetPrivate("api/user/create/", $params, 'POST');
echo '<br>RESULT:<br>';
var_dump($response);
?>

<?php

require_once "../yakwala_api.class.php";
$name = array_key_exists("name", $_GET) ? $_GET['name'] : "Yakwala";
// Set your client key and secret
$client_key = "50a0e2c4fa9a95240b000001";
$client_secret = "5645a25f963bd0ac846b17eb517cd638754f1a7b";
$redirect_uri = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Load the Yakwala API library
$yakwala = new YakwalaAPI($client_key, $client_secret);
if (array_key_exists("access_token", $_GET) && array_key_exists("id", $_GET)) {
    $yakwala->SetAccessToken($_GET['access_token']);
    $response = $yakwala->GetPrivate("api/user/" . $_GET['id']);
    $userdetails = json_decode($response);
    echo "<br><br> <b>USER DETAILS:</b> user/userid<br>";
    print_r($userdetails);
    $response = $yakwala->GetPrivate("api/user/feed/" . $userdetails->data->_id);
    $userfeed = json_decode($response);
    echo "<br><br> <b>LAST 20 INFOS POSTED:</b> user/feed/userid<br>";
    print_r($userfeed);
    $response = $yakwala->GetPrivate("api/user/search/renaud");
    $userlist = json_decode($response);
    echo "<br><br> <b>USERS SEARCH RESULTS:</b> user/search/renaud<br>";
    print_r($userlist);
} else {
    $authlink = $yakwala->AuthenticationLink($redirect_uri, 'token');
    //echo $authlink;
    header('Location:' . $authlink);
}
function showUserBasics($userBasic)
{