当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::post方法代码示例

本文整理汇总了PHP中Client::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::post方法的具体用法?PHP Client::post怎么用?PHP Client::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assignToUser

 public function assignToUser($pid, $uid, $filters = [])
 {
     $result = $this->client->post("/gdc/md/{$pid}/userfilters", ['userFilters' => ['items' => [["user" => Users::getUriFromUid($uid), "userFilters" => $filters]]]]);
     if (!isset($result['userFiltersUpdateResult']['successful']) || !count($result['userFiltersUpdateResult']['successful'])) {
         throw Exception::unexpectedResponseError('Assign filters to user failed', 'POST', "/gdc/md/{$pid}/userfilters", $result);
     }
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:7,代码来源:Filters.php

示例2: getToken

 private function getToken()
 {
     if (!$this->token) {
         $response = $this->client->post('tokens', '', json_encode(array("username" => $this->username, "password" => $this->password)))->send();
         $this->token = $response->json();
     }
     return $this->token;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:Request.php

示例3: createUser

 public function createUser($login, $password, $domain, array $options = [])
 {
     $result = $this->client->post("/gdc/account/domains/{$domain}/users", ['accountSetting' => array_merge(['login' => strtolower($login), 'email' => strtolower($login), 'password' => $password, 'verifyPassword' => $password], $options)]);
     if (isset($result['uri'])) {
         return self::getUidFromUri($result['uri']);
     } else {
         throw Exception::unexpectedResponseError('Create user failed', 'POST', "/gdc/account/domains/{$domain}/users", $result);
     }
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:9,代码来源:Users.php

示例4: schedule

 public function schedule($to, $txt, $date)
 {
     $client = new Client($this->user, $this->token);
     $data = array("destinations" => $to, "text" => $txt, "scheduleDate" => $date);
     $response = $client->post('messages', $data);
     return $response->scheduleId;
 }
开发者ID:andresilvagomez,项目名称:elibom,代码行数:7,代码来源:Scheduler.php

示例5: send

 public function send($to, $txt)
 {
     $client = new Client($this->user, $this->token);
     $data = array("destinations" => $to, "text" => $txt);
     $response = $client->post('messages', $data);
     return $response->deliveryToken;
 }
开发者ID:andresilvagomez,项目名称:elibom,代码行数:7,代码来源:Message.php

示例6: testPost

 public function testPost()
 {
     $client = new Client('', '', false);
     $email = array('FromName' => 'Mailjet PHP test', 'FromEmail' => 'dev@amo-soft.com', 'Text-Part' => 'Simple Email test', 'Subject' => 'PHPunit', 'Html-Part' => '<h3>Simple Email Test</h3>', 'Recipients' => array(array('Email' => 'test@mailjet.com')), 'MJ-custom-ID' => 'Hello ID');
     $ret = $client->post(Resources::$Email, array('body' => $email));
     $this->assertUrl('/send', $ret);
     $this->assertPayload($email, $ret);
 }
开发者ID:amosoft,项目名称:mailjet-apiv3-php,代码行数:8,代码来源:test.php

示例7: testPost

 public function testPost()
 {
     $client = new Client('', '', false);
     $email = ['FromName' => 'Mailjet PHP test', 'FromEmail' => 'gbadi@student.42.fr', 'Text-Part' => 'Simple Email test', 'Subject' => 'PHPunit', 'Html-Part' => '<h3>Simple Email Test</h3>', 'Recipients' => [['Email' => 'test@mailjet.com']], 'MJ-custom-ID' => 'Hello ID'];
     $ret = $client->post(Resources::$Email, ['body' => $email]);
     $this->assertUrl('/send', $ret);
     $this->assertPayload($email, $ret);
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:8,代码来源:test.php

示例8: postSignedJSON

 /**
  * Perform a POST request, get a decoded JSON response.
  * Internally verifies an Ed25519 signature.
  *
  * @param string $url
  * @param SignaturePublicKey $publicKey
  * @param array $params
  * @return mixed
  */
 public function postSignedJSON(string $url, SignaturePublicKey $publicKey, array $params = [])
 {
     $response = $this->client->post($url, $this->params($params, $url));
     if ($response instanceof Response) {
         return $this->parseSignedJSON($response, $publicKey);
     }
     return null;
 }
开发者ID:paragonie,项目名称:airship,代码行数:17,代码来源:Hail.php

示例9: create

 public function create($options = [])
 {
     $data = Client::post(static::endpoint(), $this->payload(), $options);
     if (count($data) > 0) {
         $data = json_decode($data, true);
     }
     return $this->parse($data);
 }
开发者ID:vicioux,项目名称:apisdk,代码行数:8,代码来源:riq_obj.php

示例10: getRefreshToken

 public static function getRefreshToken($code)
 {
     $endpoint = 'https://connect.stripe.com/oauth/token';
     $params = array('client_secret' => $_ENV['STRIPE_SECRET_KEY'], 'code' => $code, 'grant_type' => 'authorization_code');
     $url = self::makeurl($endpoint, $params);
     $client = new Client();
     $returned_object = $client->post($endpoint, ['body' => $params])->json();
     return $returned_object;
 }
开发者ID:raschan,项目名称:fruit-dashboard,代码行数:9,代码来源:OAuth2.php

示例11: diff

 public function diff($pid, $model)
 {
     $uri = "/gdc/projects/{$pid}/model/diff?includeDeprecated=true&includeGrain=true";
     $result = $this->client->post($uri, ['diffRequest' => ['targetModel' => $model]]);
     if (isset($result['asyncTask']['link']['poll'])) {
         $try = 1;
         do {
             sleep(10 * $try);
             $taskResponse = $this->client->get($result['asyncTask']['link']['poll']);
             if (!isset($taskResponse['asyncTask']['link']['poll'])) {
                 if (isset($taskResponse['projectModelDiff']['updateScripts'])) {
                     $lessDestructive = [];
                     $moreDestructive = [];
                     // Preserve data if possible
                     foreach ($taskResponse['projectModelDiff']['updateScripts'] as $updateScript) {
                         if ($updateScript['updateScript']['preserveData'] && !$updateScript['updateScript']['cascadeDrops']) {
                             $lessDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                         if (!count($lessDestructive) && !$updateScript['updateScript']['preserveData'] && !$updateScript['updateScript']['cascadeDrops']) {
                             $lessDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                         if (!$updateScript['updateScript']['preserveData'] && $updateScript['updateScript']['cascadeDrops']) {
                             $moreDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                         if (!count($moreDestructive) && $updateScript['updateScript']['preserveData'] && $updateScript['updateScript']['cascadeDrops']) {
                             $moreDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                     }
                     $description = [];
                     foreach ($taskResponse['projectModelDiff']['updateOperations'] as $o) {
                         $description[] = vsprintf($o['updateOperation']['description'], $o['updateOperation']['parameters']);
                     }
                     return ['moreDestructiveMaql' => $moreDestructive, 'lessDestructiveMaql' => $lessDestructive, 'description' => $description];
                 } else {
                     throw Exception::unexpectedResponseError('Polling of Model diff could not be finished', 'GET', $result['asyncTask']['link']['poll'], $taskResponse);
                 }
             }
             $try++;
         } while (true);
     } else {
         throw Exception::unexpectedResponseError('Polling of Model diff could not be started', 'POST', $uri, $result);
     }
     return false;
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:44,代码来源:ProjectModel.php

示例12: disableUser

 public function disableUser($uid, $pid)
 {
     try {
         $result = $this->client->get("/gdc/projects/{$pid}/users/{$uid}");
         $this->client->post("/gdc/projects/{$pid}/users", ['user' => ['content' => ['status' => 'DISABLED', 'userRoles' => $result['user']['content']['userRoles']], 'links' => ['self' => $result['user']['links']['self']]]]);
     } catch (Exception $e) {
         if ($e->getCode() != 404) {
             throw $e;
         }
     }
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:11,代码来源:Projects.php

示例13: testPOST

 public function testPOST()
 {
     // create our http client (Guzzle)
     $client = new Client('http://localhost:8000', array('request.options' => array('exceptions' => false)));
     $nickname = 'ObjectOrienter' . rand(0, 999);
     $data = array('nickname' => $nickname, 'avatarNumber' => 5, 'tagLine' => 'a test dev!');
     $request = $client->post('/api/programmers', null, json_encode($data));
     $response = $request->send();
     $this->assertEquals(201, $response->getStatusCode());
     $this->assertTrue($response->hasHeader('Location'));
     $data = json_decode($response->getBody(true), true);
     $this->assertArrayHasKey('nickname', $data);
 }
开发者ID:Infinite-Loop7,项目名称:RecipesInLaravel,代码行数:13,代码来源:test.php

示例14: loadData

 public function loadData($pid, $dirName)
 {
     $uri = "/gdc/md/{$pid}/etl/pull2";
     $result = $this->client->post($uri, ['pullIntegration' => $dirName]);
     if (isset($result['pull2Task']['links']['poll'])) {
         $try = 1;
         do {
             sleep(10 * $try);
             $taskResponse = $this->client->get($result['pull2Task']['links']['poll']);
             if (!isset($taskResponse['wTaskStatus']['status'])) {
                 throw Exception::unexpectedResponseError('ETL task could not be checked', 'GET', $result['pull2Task']['links']['poll'], $taskResponse);
             }
             $try++;
         } while ($taskResponse['wTaskStatus']['status'] == 'RUNNING');
         if ($taskResponse['wTaskStatus']['status'] == 'ERROR') {
             $errors = [];
             if (isset($taskResponse['messages'])) {
                 foreach ($taskResponse['messages'] as $m) {
                     if (isset($m['error'])) {
                         $errors[] = Exception::parseMessage($m['error']);
                     }
                 }
             }
             if (isset($taskResponse['wTaskStatus']['messages'])) {
                 foreach ($taskResponse['wTaskStatus']['messages'] as $m) {
                     if (isset($m['error'])) {
                         $errors[] = Exception::parseMessage($m['error']);
                     }
                 }
             }
             throw new Exception($errors);
         }
         return isset($taskResponse['messages']) ? $taskResponse['messages'] : [];
     } else {
         throw Exception::unexpectedResponseError('ETL task failed', 'POST', $uri, $result);
     }
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:37,代码来源:Datasets.php

示例15: send

 /**
  * Send notification to LeanCloud
  *
  * @return array
  */
 public function send()
 {
     $out = $this->encode();
     $resp = Client::post("/push", $out);
     return $resp;
 }
开发者ID:juvenn,项目名称:php-sdk,代码行数:11,代码来源:Push.php


注:本文中的Client::post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。