Пример #1
0
 /**
  * Send requests
  * Get all answers
  */
 function send_request()
 {
     $data = array('token' => $this->token, 'request' => $this->request);
     $result = Api::action($this->token, $this->request);
     $result = json_decode(json_encode($result));
     if (!empty($result)) {
         if (!empty($result->level)) {
             $this->level = $result->level;
         }
         if (!empty($result->language) && $result->language != 'en') {
             $this->language = $result->language;
             if (!defined('LOCALE')) {
                 defineLocale($this->language);
             }
         } else {
             if (!defined('LOCALE')) {
                 defineLocale(detect_language());
             }
         }
         if (!empty($result->design)) {
             $this->design = $result->design;
         }
         if (isset($result->id) && $result->id == 0) {
             //Destruct cookies
             setcookie('token', '', 0, '/');
             //	redirect();
         } elseif (!empty($_COOKIE['token'])) {
             //2 weeks
             setcookie('token', $_COOKIE['token'], $_SERVER['REQUEST_TIME'] + 3600 * 24 * 14, '/');
             if (!empty($result->id)) {
                 $this->id = $result->id;
             }
         }
     } else {
         $result = null;
         if (!defined('LOCALE')) {
             defineLocale(detect_language());
         }
     }
     if (!defined('TEMPLATE')) {
         $this->setDesign();
     }
     return $result->request;
 }
Пример #2
0
<?php

error_reporting(E_ALL | E_STRICT);
include '../api.php';
$api = new Api('http://devapirn.loc/v1/');
$api->action('auth/signup');
$params = array('email' => '*****@*****.**', 'password' => 'password');
$api->params($params);
$api->raw();
$result = $api->post();
$api->debug(1);
print_r($result);
Пример #3
0
<?php

include 'config.php';
include 'functions.php';
header('ACCESS-Control-Allow-Origin: *');
header('ACCESS-Control-Allow-Methods: POST, GET');
header('ACCESS-Control-Allow-Headers: x-requested-width');
ini_set('display_errors', 1);
error_reporting(E_ALL);
include 'libs/PHPMailer/class.phpmailer.php';
include 'libs/Link.class.php';
include 'libs/Socket.class.php';
include 'libs/Guest.class.php';
include 'libs/User.class.php';
include 'libs/Admin.class.php';
include 'libs/Root.class.php';
include 'libs/Api.class.php';
if (!empty($_GET)) {
    $_POST = $_GET;
}
if (empty($_POST['token'])) {
    $_POST['token'] = null;
}
if (empty($_POST['request'])) {
    $_POST['request'] = null;
}
$answer = Api::action($_POST['token'], $_POST['request']);
echo json_encode($answer);
Пример #4
0
<?php

error_reporting(E_ALL | E_STRICT);
include '../api.php';
$api = new Api('https://api.twitter.com/1/');
$params = array('include_entities' => 'true', 'screen_name' => 'rhrn');
$result = $api->action('users/lookup.json')->params($params)->get();
$api->debug(1);
print_r($result);
Пример #5
0
<?php

error_reporting(E_ALL | E_STRICT);
include '../api.php';
/*
	$config = array();

	$config['client_id']		= '2760348';
	$config['scope']		= 'notify,friends,photos,audio,messages,offline';
	$config['display']		= 'popup';
	$config['response_type']	= 'token';
	$config['redirect_uri']		= 'http://api.vk.com/blank.html';

	$auth = new Api('http://oauth.vk.com/authorize/', $config);

	$result = $auth->getURL(); # url access permitions

	echo ($result) . "\n";
*/
$vk = new Api('https://api.vk.com/method/');
$params['uid'] = '2194115';
$params['access_token'] = '36bbb262369ac8a1369ac8a1ca36b0d63d3369b369bd8af6810fde9c62281ee';
$result = $vk->action('messages.get')->params($params)->get();
$vk->debug(1);
print_r($result);