本文整理汇总了PHP中Api::action方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::action方法的具体用法?PHP Api::action怎么用?PHP Api::action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::action方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_request
/**
* 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: Api
<?php
error_reporting(E_ALL | E_STRICT);
include '../api.php';
$api = new Api('http://devapirn.loc/v1/');
$api->action('auth/signup');
$params = array('email' => 'email@email.com', 'password' => 'password');
$api->params($params);
$api->raw();
$result = $api->post();
$api->debug(1);
print_r($result);
示例3: header
<?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: Api
<?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: array
<?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);