本文整理汇总了PHP中Api::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::post方法的具体用法?PHP Api::post怎么用?PHP Api::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::post方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchProfileDetailsByBusinessData
/**
* Fetch profile details by business data
*
* @param Batch $batch The batch to add this to
* @param string[] $parameters The parameters for request
* @throws \Exception
*/
public function fetchProfileDetailsByBusinessData(Batch $batch, $parameters)
{
if ($batch->hasBeenCommitted()) {
throw new \Exception("Attempting to add task to a batch which has already been comitted!");
}
$parameters['batch-id'] = $batch->getBatchId();
$this->api->post('/v4/ld/fetch-profile-details-by-business-data', $parameters);
}
示例2: create
/**
* Create batch
*
* @param bool $stopJobOnError Should the batch be halted on error?
* @throws \Exception
*/
public function create($stopJobOnError = false)
{
$response = $this->api->post('/v4/batch', ['stop-on-job-error' => (int) $stopJobOnError]);
if (!isset($response['success']) || !$response['success']) {
throw new \Exception("Response was not successful.");
}
if (!isset($response['batch-id'])) {
throw new \Exception("No batch ID found in response.");
}
$this->setBatchId($response['batch-id']);
}
示例3: send
public function send($title, $text, $from = NULL, $to, $parent_id = 0, $to_from = TRUE)
{
if (!is_array($to)) {
$to = array($to);
}
if (!empty($to)) {
if ($from !== NULL and $to_from === TRUE) {
$to[] = $from;
}
$to = array_unique($to);
$users = DB::select('id', 'email')->from('users')->where('id', 'IN', $to)->execute()->as_array('id', 'email');
$message = Kses::filter($text, Kohana::$config->load('global')->get('allowed_html_tags'));
$data = array('created_on' => date('Y-m-d H:i:s'), 'text' => $message, 'title' => $title, 'from_user_id' => $from);
list($message_id, $rows) = DB::insert($this->table_name())->columns(array_keys($data))->values($data)->execute($this->_db);
if ($message_id) {
$insert = DB::insert('messages_users')->columns(array('status', 'user_id', 'message_id', 'parent_id'));
foreach ($users as $id => $email) {
$insert->values(array('status' => self::STATUS_NEW, 'user_id' => (int) $id, 'message_id' => $message_id, 'parent_id' => (int) $parent_id));
self::clear_cache($id);
Observer::notify('send_message', (int) $id, $text);
}
$insert->execute($this->_db);
if ($from !== NULL) {
Api::post('user-messages.mark_read', array('id' => $message_id, 'uid' => $from));
}
return $message_id;
}
}
return FALSE;
}
示例4: get_list
public function get_list()
{
$this->get_get();
$messages = $this->json['response'];
$response_messages = array();
foreach ($messages as $msg) {
$msg = (object) $msg;
if ($msg->is_read == Model_API_Message::STATUS_NEW) {
Api::post('user-messages.mark_read', array('id' => $msg->id, 'uid' => Auth::get_id()));
}
$response_messages[] = (string) View::factory('messages/item')->set('message', (object) $msg);
}
$this->response($response_messages);
}
示例5: 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);
}
示例6: 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);
示例7: remind
/**
* Sends a reminder to sign to the user.
*
* @param string? $text Optional, text to include in the reminder message.
*/
public function remind($text = null)
{
$id = preg_replace("/[^A-Za-z0-9\\- ]/", '', $this->id);
Api::post('signer/' . $id . '/send-reminder/', ['text' => $text]);
}
示例8: Api
<?php
require __DIR__ . '/credentials.php';
require __DIR__ . '/../facturama/Api.php';
$facturma = new Api(USER, PASSWORD);
$params = ["Address" => ["Street" => "St One ", "ExteriorNumber" => "15", "InteriorNumber" => "12", "Neighborhood" => "Lower Manhattan, ", "ZipCode" => "sample string 5", "Locality" => "sample string 6", "Municipality" => "sample string 7", "State" => "sample string 8", "Country" => "MX"], "Rfc" => "XEXX010101000", "Name" => "Test Test", "Email" => "test@facturma.com"];
$result = $facturma->post('Client', $params);
printf('<pre>%s<pre>', var_export($result, true));