// 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"); $response = $yakwala->GetPrivate("api/user/feed/" . $userid, $params, 'POST'); $insert = $response; echo '<br>RESULT:<br>'; var_dump($insert);
$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 '<br>TOKEN' . $response->access_token . '<br>'; $yakwala->SetAccessToken($response->access_token); showUserBasics($response->user); $userid = $response->user->id; // POST favplace $params = array('place' => json_encode(array(array('name' => 'api test1111', 'location' => array('lat' => 10, 'lng' => 20)), array('name' => 'api test22222', 'location' => array('lat' => 11, 'lng' => 22))))); $response = $yakwala->GetPrivate("api/favplace/" . $userid, $params, 'POST'); $insert = json_decode($response); var_dump($insert); // POST user subscribtion to user feed $params = array('usersubs' => json_encode(array('50cee95bcb7b8e2410000004'))); $response = $yakwala->GetPrivate("api/subscribe/user/" . $userid, $params, 'POST'); $insert = json_decode($response); var_dump($insert); // POST user subscribtion to tags $params = array('tagsubs' => json_encode(array('tag1', 'tag2'))); $response = $yakwala->GetPrivate("api/subscribe/tag/" . $userid, $params, 'POST'); $insert = json_decode($response); var_dump($insert); } else { $authlink = $yakwala->AuthenticationLink($redirect_uri); //echo $authlink;
<?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);
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); $userid = $response->user->id; // PUT a place $params = array("place" => json_encode(array("_id" => "50d0733e37ee89481a000020", "title" => 'place title updated', "content" => 'place content updated', "yakcat" => array('50923b9afa9a95d409000000', '50923b9afa9a95d409000001'), "freetag" => array('tag11 updated', 'tag22 updated'), "outgoinglink" => 'http://www.theplacewebsiteupdated.com', "location" => array('lat' => 48.5, 'lng' => 2.5), "formatted_address" => " 3 rue du Ruisseau updated, Paris , France", "address" => array("street_number" => "3updated", "street" => "rue du Ruisseauupdated", "arr" => "updated", "city" => "Parisupdated", "state" => "Parisupdated", "area" => "Ile de Franceupdated", "country" => "Franceupdated", "zip" => "75018updated"), "contact" => array("mobile" => "0612345678updated2", "mail" => "*****@*****.**", "transportation" => "metro 3 station Ruisseauupdated", "web" => "http://www.theplace.comupdated", "opening" => "Tlj de 8h à 20hupdated", "closing" => "dimancehs et jours fériésupdated", "specialopening" => "Nocture le jeudi de 19h à minuitupdated"))), "picture" => "@C:\\miro.jpg;type=image/jpeg"); $response = $yakwala->GetPrivate("api/place/" . $userid, $params, 'PUT'); $insert = $response; var_dump($insert); } else { $authlink = $yakwala->AuthenticationLink($redirect_uri); //echo $authlink; header('Location:' . $authlink); } function showUserBasics($userBasic) { echo "\n\t\t\t<br>Name: <b>" . $userBasic->full_name . "</b><br>\n\t\t\tLogin: <b>" . $userBasic->username . "</b><br>\n\t\t\tProfile Picture: <img src='" . $userBasic->profile_picture . "' width='20' />\n\t\t"; } ?>
<?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) {