本文整理汇总了PHP中Api::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::get方法的具体用法?PHP Api::get怎么用?PHP Api::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
protected function load()
{
$result = $this->api->get($this->method, array_merge($this->params, array('limit' => $this->limit, 'offset' => $this->offset)))->getResult();
$this->meta = $result['_meta'] ?: array('limit' => $this->limit, 'offset' => $this->offset, 'count' => 0);
$this->results = $result['results']->getArrayCopy() ?: array();
if ($this->meta['limit'] < $this->limit) {
$this->limit = $this->meta['limit'];
}
if (empty($this->results)) {
$this->finished = true;
}
}
示例2: getResults
/**
* Get batch results
*
* @return array
* @throws \Exception
*/
public function getResults()
{
$response = $this->api->get('/v4/batch', ['batch-id' => $this->getBatchId()]);
if (!isset($response['success']) || !$response['success']) {
throw new \Exception("Response was not successful.");
}
return $response;
}
示例3: list_serveur
public function list_serveur()
{
$apk = "YLVnWI9vwB5nYEg0";
$endpoint = "ovh-eu";
$ask = "bDPjuf931jLDmhMMbTLSfatartv43rzB";
$csk = "is8M5oyHUJNR7UfxB5ToF6wQWAcMPfxn";
$ovh = new Api($apk, $ask, $endpoint, $csk);
$liste_server = array();
while ($liste_server) {
$ovh->get("/vps");
}
return $liste_server;
}
示例4: setUp
protected function setUp()
{
$cache = new ApcCache();
$cache->clear();
$this->linkResolver = new FakeLinkResolver();
$this->id = 'Ue0EDd_mqb8Dhk3j';
$type = 'product';
$tags = array('macaron');
$slugs = array('ABCD');
$isBroken = false;
$href = "http://myrepo.prismic.io/Ue0EDd_mqb8Dhk3j";
$this->document = new Document($this->id, null, $type, $href, $tags, $slugs, array());
$this->link = new DocumentLink($this->id, null, $type, $tags, $slugs[0], array(), $isBroken);
$response = file_get_contents(__DIR__ . '/../fixtures/data.json');
$mock = new MockHandler([new Response(200, [], $response), new Response(200, [], $response), new Response(200, [], $response), new Response(200, [], $response), new Response(200, [], $response), new Response(200, [], $response), new Response(200, [], $response), new Response(200, [], $response), new Response(200, [], $response)]);
$handler = HandlerStack::create($mock);
$client = new Client(['handler' => $handler]);
$this->api = Api::get('dont care about this value', null, $client, $cache);
}
示例5: setUp
protected function setUp()
{
$cache = new ApcCache();
$cache->clear();
$this->linkResolver = new FakeLinkResolver();
$this->id = 'Ue0EDd_mqb8Dhk3j';
$type = 'product';
$tags = array('macaron');
$slugs = array('ABCD');
$isBroken = false;
$href = "http://myrepo.prismic.io/Ue0EDd_mqb8Dhk3j";
$this->document = new Document($this->id, null, $type, $href, $tags, $slugs, array());
$this->link = new DocumentLink($this->id, null, $type, $tags, $slugs[0], array(), $isBroken);
$response = $this->getMockBuilder('Ivory\\HttpAdapter\\Message\\Response')->disableOriginalConstructor()->getMock();
$response->expects($this->once())->method('getBody')->will($this->returnValue(file_get_contents(__DIR__ . '/../fixtures/data.json')));
$httpAdapter = $this->getMock('Ivory\\HttpAdapter\\HttpAdapterInterface');
$httpAdapter->expects($this->any())->method('get')->will($this->returnValue($response));
$this->api = Api::get('don\'t care about this value', null, $httpAdapter, $cache);
}
示例6: action_view
public function action_view()
{
$id = (int) $this->request->param('id');
$user_id = Auth::get_id();
$message = Api::get('user-messages.get_by_id', array('id' => $id, 'uid' => $user_id, 'fields' => 'author,title,is_read,created_on,text,is_starred'))->as_object();
if (!$message->response) {
throw new HTTP_Exception_404('Message not found');
}
if ($this->request->method() === Request::POST) {
$this->auto_render = FALSE;
$post = $this->request->post();
$post['from_user_id'] = $user_id;
$post['parent_id'] = $id;
return $this->_send(Api::put('user-messages', $post), $id);
}
$read = Api::post('user-messages.mark_read', array('id' => $id, 'uid' => $user_id));
$messages = Api::get('user-messages.get', array('uid' => $user_id, 'fields' => 'author,from_user_id,title,is_read,created_on,text,is_starred', 'pid' => $id))->as_object();
$this->template->content = View::factory('messages/view', array('tpl' => View::factory('messages/item'), 'message' => $message->response, 'messages' => $messages->response, 'from_user' => ORM::factory('user', $message->response->from_user_id)));
$this->set_title($message->response->title);
}
示例7: Api
<?php
require __DIR__ . '/credentials.php';
require __DIR__ . '/../facturama/Api.php';
$facturma = new Api(USER, PASSWORD);
$params = [];
$result = $facturma->get('Client', $params);
printf('<pre>%s<pre>', var_export($result, true));
示例8: refresh
/**
* Refresh Object Data
*
* @param array $parameters Parameters for refreshing the Object.
*
* @return \CloudConvert\ApiObject
*
* @throws \CloudConvert\Exceptions\ApiException if the CloudConvert API returns an error
* @throws \GuzzleHttp\Exception if there is a general HTTP / network error
*
*/
public function refresh($parameters = null)
{
$this->data = $this->api->get($this->url, $parameters, false);
return $this;
}
示例9: fetch_data
public function fetch_data()
{
return array('logs' => Api::get('log.get', array('level' => Log::INFO))->as_object()->get('response'));
}
示例10: alipay
/**
* 支付宝支付
*/
public function alipay(){
if(!$_REQUEST['order_sn'] && !$_REQUEST['mo_sn']){
$this->error('订单号必须');
}
$model = M('Order');
if($_REQUEST['order_sn']){
$data['order_sn'] = $_REQUEST['order_sn'];
$out_trade_no = $_REQUEST['order_sn'];
//单一订单支付
$notify_url = C('SITE_URL') . '/index.php/Ali_Payment/notify';
$return_url = C('SITE_URL') . '/index.php/Order/index?order_sn='.$_REQUEST['order_sn'];
$body .= '订单支付:'.$_REQUEST['order_sn'].'';
}
if($_REQUEST['mo_sn']){
$data['mo_sn'] = $_REQUEST['mo_sn'];
$out_trade_no = $_REQUEST['mo_sn'];
//多订单合并支付
$notify_url = C('SITE_URL') . '/index.php/Ali_Payment/notify_merge';
$return_url = C('SITE_URL') . '/index.php/Order/index?mo_sn='.$_REQUEST['mo_sn'];
$body .= '订单合并支付:'.$_REQUEST['mo_sn'].'';
}
$data['member_id'] = $this->user['id'];
$orders = $model->field('id,seller_id,bond,type,actual_paid,order_sn,order_time,member_id,member_name,pay_status,status')->where($data)->select();
if(!$orders){
$this->error('订单不存在');
}
$total_fee = 0;
$title = '';
foreach($orders as $key=>$order){
$total_fee += $order['actual_paid'];
$titles[] = $order['title'];
if($order['pay_status']>0){
$this->error($order['order_sn'].'订单状态错误');
}
}
//支付接口请求
require_once(C('INTERFACE_PATH')."Api/config.php");
require_once(C('INTERFACE_PATH')."Api/Api.class.php");
$api = new Api($config);
$para['m'] = 'Payment';
$para['a'] = 'aliWapPay';
if($_REQUEST['order_sn'])$data['order_sn'] = $_REQUEST['order_sn'];
if($_REQUEST['mo_sn'])$data['mo_sn'] = $_REQUEST['mo_sn'];
//$html = $api->buildRequestForm($para,$data);
//echo $html;exit;
//dump($html);exit;
$result = json_decode($api->get($para,$data),true);
//dump($result);exit;
if($result['error_code']==0){
header("Location:".$result['pay_url']);exit;
}else{
$this->error($result['notice']);
}
/*
//支付宝
include C('INTERFACE_PATH')."aliwappay/lib/alipay_submit.class.php";
//支付信息
//$pay_configs = include C('PUBLIC_CACHE').'/config/pay.php';
$pay_configs = getCache('Config:pay');
$alipay_config = unserialize($pay_configs['ali']['content']);
$alipay_config['seller_id'] = $alipay_config['seller_email'];
$alipay_config['sign_type'] = strtoupper('RSA');
$alipay_config['input_charset'] = strtolower('utf-8');
$alipay_config['cacert'] = C('INTERFACE_PATH').'aliwappay/cacert.pem';
$alipay_config['private_key_path'] = C('INTERFACE_PATH').'aliwappay/key/rsa_private_key.pem';
$alipay_config['ali_public_key_path'] = C('INTERFACE_PATH').'aliwappay/key/alipay_public_key.pem';
$alipay_config['transport'] = 'http';
$alipaySubmit = new AlipaySubmit($alipay_config);
$payment_type = "1";
$exter_invoke_ip = $_SERVER['REMOTE_ADDR'];
$subject = $body;
$parameter = array(
"service" => "alipay.wap.create.direct.pay.by.user",
"partner" => trim($alipay_config['partner']),
"seller_id" => trim($alipay_config['seller_id']),
"sign_type" => 'RSA',
"payment_type" => $payment_type,
"notify_url" => $notify_url,
"return_url" => $return_url,
"out_trade_no" => $out_trade_no,
"subject" => $subject,
"total_fee" => $total_fee,
"notify_url" => $notify_url,
"return_url" => C('WAP_URL').'/index.php/Order',
//"show_url" => $show_url,
"body" => $subject,
//"it_b_pay" => $it_b_pay,
//"extern_token" => $extern_token,
"extra_common_param"=>'pay_type|2,payment_channel|wap', //参数
"_input_charset" => trim(strtolower($alipay_config['input_charset']))
);
$para = 'https://mapi.alipay.com/gateway.do?'.$alipaySubmit->buildRequestParaToString($parameter);
header("Location:".$para);exit;
//$html_text = $alipaySubmit->buildRequestForm($parameter,"post", "确认");
//echo $html_text;exit;
//.........这里部分代码省略.........
示例11: action_index
public function action_index()
{
$this->template->title = __('Backup');
$this->template->content = View::factory('backup/index', array('files' => Api::get('backup.list')->as_object()->response));
}
示例12: getPrice
/**
* Get prices for given product
*
* @param $id
* @return mixed
*/
public function getPrice($id)
{
return $this->api->get("/products/price/{$id}");
}
示例13: get
}
}
class Api
{
function get($val, $key)
{
return $key . " = " . $val . " ... Done";
}
}
$DB = new DB();
$API = new Api();
$a = new GetterUnit();
$a->data = $DB->data();
$b = new SenderUnit();
$b->requestHandler(function ($key, $value) use($API) {
return $API->get($value, $key);
});
$a->responseHandler(function ($key, $value) use($DB) {
return $DB->status($key, $value);
});
$sync = new Sync($a, $b);
// TEST 1
$sync->go();
print_r($DB->result);
// TEST 2
$sync->syncHandler(function ($data, $sync) {
foreach ($data as $key => $value) {
$result = $sync->requestHandler($key, $value);
$sync->responseHandler($key, $result . " - test");
}
});
示例14: defined
<?php
defined('SYSPATH') or die('No direct access allowed.');
Observer::observe('view_user_profile_information', function ($user_id) {
$logs = Api::get('log.get', array('uids' => $user_id, 'level' => Log::INFO))->as_object()->get('response');
echo View::factory('logs/profile/activity', array('user_id' => (int) $user_id, 'logs' => $logs));
});
Observer::observe('view_setting_plugins', function () {
echo View::factory('logs/settings');
});
Observer::observe('view_navbar_menu', function () {
echo View::factory('logs/navbar');
});