• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP Client类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testCreatePushURI

 public function testCreatePushURI()
 {
     $client = new Client('', true);
     $pushUri = $client->getPushURI((new Message())->setDeviceIdentifier('foobar'));
     $this->assertContains('develop', $pushUri);
     $this->assertContains('foobar', $pushUri);
 }
开发者ID:gepo,项目名称:apns-http2,代码行数:7,代码来源:ClientTest.php


示例2: testClose

 public function testClose()
 {
     $c = new Client();
     $c->connect();
     $this->assertInstanceOf("Bunny\\Protocol\\MethodChannelCloseOkFrame", $c->channel()->close());
     $c->disconnect();
 }
开发者ID:Andrewsville,项目名称:bunny,代码行数:7,代码来源:ChannelTest.php


示例3: lxserver_main

function lxserver_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    global $argv, $argc;
    if ($argv[1] === 'slave') {
        $login = new Client(null, null, 'slave');
        $gbl->is_slave = true;
        $gbl->is_master = false;
        $rmt = unserialize(lfile_get_contents("__path_slave_db"));
        $login->password = $rmt->password;
        $argv[1] = "Running as Slave";
    } else {
        if ($argv[1] === 'master') {
            $login = new Client(null, null, 'admin');
            $gbl->is_master = true;
            $gbl->is_slave = false;
            $login->get();
            $argv[1] = "Running as Master";
        } else {
            print "Wrong arguments\n";
            exit;
        }
    }
    $login->cttype = 'admin';
    // Set php script execution timer to unlimited
    set_time_limit(0);
    // Start internal socket for remote
    some_server();
}
开发者ID:soar-team,项目名称:kloxo,代码行数:29,代码来源:lxserverlib.php


示例4: actionCompleteRegistrationAjax

 public function actionCompleteRegistrationAjax()
 {
     $client = new Client();
     $client->attributes = $_POST['Client'];
     if ($client->save()) {
         $drive = new Drive();
         $drive->attributes = $_POST['Drive'];
         $drive->client_id = $client->primaryKey;
         $drive->creation_date = date("Y-m-d H:i:s");
         if ($drive->save()) {
             $driv = Drive::model()->findByPk($drive->primaryKey);
             $message = new YiiMailMessage();
             $message->view = 'pruebamanejo';
             $message->setBody(array("client" => $client, "drive" => $driv), 'text/html');
             $message->setSubject('Solicitud Prueba de Manejo');
             foreach ($driv->concessioner->emails as $email) {
                 // if($email->type=="DRIVE"){
                 if ($email->type == "QUOTATION") {
                     $message->addTo($email->description);
                 }
             }
             //          		$message->addTo("[email protected]");
             //				$message->addTo("[email protected]");
             $message->addTo("[email protected]");
             $message->addTo("[email protected]");
             $message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador'));
             Yii::app()->mail->send($message);
             echo json_encode(true);
         } else {
             echo json_encode(false);
         }
     }
 }
开发者ID:frankpaul142,项目名称:nissan-modulos,代码行数:33,代码来源:DefaultController.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: trim

/**
 * 创建client实例
 */
function &getSingleClient($smownerid)
{
    global $current_user;
    static $client = false;
    if ($client === false) {
        global $adb;
        $gwUrl = 'http://sdkhttp.eucp.b2m.cn/sdk/SDKService';
        $sql = "select * from ec_messageaccount where smownerid='" . $smownerid . "'";
        $result = $adb->query($sql);
        $serialNumber = trim($adb->query_result($result, 0, 'username'));
        $password = trim($adb->query_result($result, 0, 'password'));
        //$password='12345';
        $sessionKey = $password;
        $connectTimeOut = 5;
        /**
         * 远程信息读取超时时间,单位为秒
         */
        $readTimeOut = 10;
        /**
                $proxyhost		可选,代理服务器地址,默认为 false ,则不使用代理服务器
                $proxyport		可选,代理服务器端口,默认为 false
                $proxyusername	可选,代理服务器用户名,默认为 false
                $proxypassword	可选,代理服务器密码,默认为 false
        */
        $proxyhost = false;
        $proxyport = false;
        $proxyusername = false;
        $proxypassword = false;
        $client = new Client($gwUrl, $serialNumber, $password, $sessionKey, $proxyhost, $proxyport, $proxyusername, $proxypassword, $connectTimeOut, $readTimeOut);
        $client->setOutgoingEncoding("UTF-8");
    }
    return $client;
}
开发者ID:honj51,项目名称:taobaocrm,代码行数:36,代码来源:SmsLib.php


示例7: view

 /**
  * The catalog view handler.
  * 
  * @param int $id The Product id.
  * @return string The HTML code.
  */
 public function view($id = null)
 {
     $Product = new Proud();
     $Product = $Product->findItem(array('Id = ' . $id));
     $Client = new Client();
     if (!$Product->Id) {
         return $this->halt();
     }
     $Category = $Product->getCategory();
     /*	$this->getView()->set('Product', $Product); */
     $this->getView()->set(array('Product' => $Product, 'Client' => $Client->findItem(array('Id = ' . $Product->CategoryId))));
     $this->getView()->setMethod('view');
     /*
     		if ( $Product->getCategory()->getLayout() instanceof Product_Layout_Custom )
     		{
     			$this->getView()->setMethod('custom');
     		}
     		elseif ( $Product->getCategory()->getLayout() instanceof Product_Layout_Common )
     		{
     			$this->getView()->setMethod('common');
     		}
     		$this->getView()->activeMenu = $Category;
     		$this->setContentPage($Category);
     		
     		$Page = $this->getContentPage();
     		$Page->SeoTitle = $Product->SeoTitle ? $Product->SeoTitle : $Product->Name;
     		$Page->SeoDescription = $Product->SeoDescription;
     		$Page->SeoKeywords = $Product->SeoKeywords;
     */
     return $this->getView()->render();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:37,代码来源:clients.php


示例8: testClientCanBeCreated

 public function testClientCanBeCreated()
 {
     $a = new GiroAccount(123, 250);
     $b = new Client($a);
     $b->setAccount($a);
     $c = null;
 }
开发者ID:beathorst,项目名称:Nicetrash,代码行数:7,代码来源:ClientTest.php


示例9: request

 /**
  * Perform a cURL request and decode the JSON response.
  * Can throw and exception if the request can't be successfully executed.
  *
  * @param Client $client   The client making the request, so we can extract
  *                         the API Key and Password
  * @param string $resource The API resource/path to request
  * @param string $method   The HTTP verb to use (GET|POST|PUT|DELETE)
  * @param array  $data     Collection of data to be sent with the request
  *
  * @return string Decoded JSON object
  */
 public static function request($client, $resource, $method, $data = array())
 {
     $curl = curl_init();
     $url = self::$endPoint . $resource;
     if (sizeof($data)) {
         if ($method == 'POST') {
             curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
         } elseif ($method == 'GET') {
             $url .= '?' . http_build_query($data);
         }
     }
     if ($method == 'POST' && sizeof($data)) {
         $body = json_encode($data);
     } else {
         $body = '';
     }
     $nonce = (int) (microtime(true) * 1000000.0);
     $message = $nonce . $url . $body;
     $signature = hash_hmac('sha256', $message, $client->getApiPass());
     $headers = array('Access-Key:' . $client->getApiKey(), 'Access-Nonce:' . $nonce, 'Content-Type:' . 'application/json', 'Access-Signature:' . $signature);
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_HEADER, 1);
     curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
     $response = curl_exec($curl);
     if ($response === false) {
         throw new \Exception('No response from curl_exec in ' . __METHOD__);
     }
     $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
     $responseBody = substr($response, $headerSize);
     curl_close($curl);
     return json_decode($responseBody);
 }
开发者ID:cuecloud,项目名称:cuecloud-php,代码行数:45,代码来源:Http.php


示例10: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client(getenv('PHPMONGO_DSN') ? getenv('PHPMONGO_DSN') : null);
     // select database
     $this->database = $client->getDatabase('test');
 }
开发者ID:sokil,项目名称:php-mongo,代码行数:7,代码来源:DatabaseTest.php


示例11: get

 /**
  * Get instance of connection
  * 
  * @param string $name connection identifier
  * @return \Sokil\Mongo\Client
  * @throws \Sokil\Mongo\Exception
  */
 public function get($name)
 {
     // get from cache
     if (isset($this->pool[$name])) {
         return $this->pool[$name];
     }
     // check if connection exists
     if (!isset($this->configuration[$name])) {
         throw new Exception('Connection with name ' . $name . ' not found');
     }
     // check if dsn exists
     if (!isset($this->configuration[$name]['dsn'])) {
         $this->configuration[$name]['dsn'] = null;
     }
     // check if connect options exists
     if (empty($this->configuration[$name]['connectOptions'])) {
         $this->configuration[$name]['connectOptions'] = null;
     }
     // init client
     $client = new Client($this->configuration[$name]['dsn'], $this->configuration[$name]['connectOptions']);
     if (isset($this->configuration[$name]['mapping'])) {
         $client->map($this->configuration[$name]['mapping']);
     }
     if (isset($this->configuration[$name]['defaultDatabase'])) {
         $client->useDatabase($this->configuration[$name]['defaultDatabase']);
     }
     $this->pool[$name] = $client;
     return $client;
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:36,代码来源:ClientPool.php


示例12: add

 public function add(Request $request)
 {
     // Ask if we are supplying our own data or requesting it from the server
     if ($request->has('remote') && ($request->remote = 'true')) {
         $client = new Client();
         $res = $client->request('GET', 'http://fsvaos.net/api/central/aircraft', ['query' => ['icao' => $request->icao]])->getBody();
         // Add the airport to the database
         $data = json_decode($res, true);
         $aircraft = new Aircraft();
         //return dd($data);
         $aircraft->name = $data[0]['name'];
         $aircraft->icao = $data[0]['icao'];
         $aircraft->maxgw = $data[0]['maxgw'];
         $aircraft->maxpax = $data[0]['maxpax'];
         $aircraft->range = $data[0]['range'];
         $aircraft->registration = $request->input('registration');
         $aircraft->enabled = true;
         $aircraft->hub = $request->input('hub');
         $aircraft->save();
     } else {
         // insert manual entry system.
         $aircraft = new Aircraft();
         //return dd($data);
         $aircraft->name = $request->input('name');
         $aircraft->icao = $request->input('icao');
         $aircraft->maxgw = $request->input('maxgw');
         $aircraft->maxpax = $request->input('maxpax');
         $aircraft->range = $request->input('range');
         $aircraft->registration = $request->input('registration');
         $aircraft->enabled = true;
         $aircraft->hub = $request->input('hub');
         $aircraft->save();
     }
 }
开发者ID:CardinalHorizon,项目名称:VAOS,代码行数:34,代码来源:FleetAPI.php


示例13: testAudioInstanceCreatedForWord

 public function testAudioInstanceCreatedForWord()
 {
     $c = new Client();
     $c->setApiKey('foobar');
     $request = $c->wordAudio('bar');
     $this->assertInstanceOf('Picnik\\Requests\\Word\\AudioRequest', $request);
 }
开发者ID:alanly,项目名称:picnik,代码行数:7,代码来源:ClientTest.php


示例14: getWeatherFor

 public function getWeatherFor($city)
 {
     $client = new Client(['base_uri' => 'http://api.openweathermap.org/data/2.5/', 'timeout' => 2.0]);
     $response = $client->get('weather?q=' . $city);
     $contents = $response->getBody()->getContents();
     return json_decode($contents);
 }
开发者ID:rocketage,项目名称:Acmetraining,代码行数:7,代码来源:MyBlock.php


示例15: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $this->database = $client->getDatabase('test');
 }
开发者ID:agolomazov,项目名称:php-mongo,代码行数:7,代码来源:DatabaseTest.php


示例16: setUp

 public function setUp()
 {
     // connect to mongo
     $client = new Client();
     // select database
     $this->database = $client->map(array('test' => array('cars' => '\\Sokil\\Mongo\\DocumentRelationTest\\CarsCollection', 'engines' => '\\Sokil\\Mongo\\DocumentRelationTest\\EnginesCollection', 'wheels' => '\\Sokil\\Mongo\\DocumentRelationTest\\WheelsCollection', 'drivers' => '\\Sokil\\Mongo\\DocumentRelationTest\\DriversCollection', 'wrongRel' => '\\Sokil\\Mongo\\DocumentRelationTest\\WrongRelationCollection')))->getDatabase('test');
 }
开发者ID:bingochen87,项目名称:php-mongo,代码行数:7,代码来源:DocumentRelationTest.php


示例17: testConstruct_HostAndPortGiven_SetsCreateTransport

 public function testConstruct_HostAndPortGiven_SetsCreateTransport()
 {
     $client = new Client('somehost', 7575);
     $transport = $client->getTransport();
     $this->assertInstanceOf('Everyman\\Neo4j\\Transport', $transport);
     $this->assertEquals('http://somehost:7575/db/data', $transport->getEndpoint());
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:7,代码来源:ClientTest.php


示例18: createClient

 protected static function createClient()
 {
     $config = static::getConfig();
     $client = new Client();
     $client->configure(['username' => $config['username'], 'password' => $config['password'], 'hostname' => $config['host'], 'port' => $config['port']]);
     return $client;
 }
开发者ID:bazo,项目名称:php-orientdb,代码行数:7,代码来源:TestCase.php


示例19: loadData

 public function loadData($pid, $name, $tmpDir)
 {
     // Upload to WebDav
     $webDav = new WebDav($this->gdClient->getUsername(), $this->gdClient->getPassword(), $this->gdClient->getUserUploadUrl());
     $dimensionName = Identifiers::getIdentifier($name);
     $tmpFolderNameDimension = "{$pid}-{$dimensionName}-" . uniqid();
     $tmpFolderDimension = $tmpDir . '/' . Identifiers::getIdentifier($name);
     mkdir($tmpFolderDimension);
     $timeDimensionManifest = self::getDataLoadManifest($dimensionName);
     file_put_contents("{$tmpFolderDimension}/upload_info.json", $timeDimensionManifest);
     copy(__DIR__ . '/time-dimension.csv', "{$tmpFolderDimension}/{$dimensionName}.csv");
     $webDav->createFolder($tmpFolderNameDimension);
     $webDav->upload("{$tmpFolderDimension}/upload_info.json", $tmpFolderNameDimension);
     $webDav->upload("{$tmpFolderDimension}/{$dimensionName}.csv", $tmpFolderNameDimension);
     // Run ETL task of time dimensions
     try {
         $this->gdClient->getDatasets()->loadData($pid, $tmpFolderNameDimension);
     } catch (Exception $e) {
         $debugFile = "{$tmpFolderDimension}/{$pid}-etl.log";
         $logSaved = $webDav->saveLogs($tmpFolderDimension, $debugFile);
         if ($logSaved) {
             $data = file_get_contents($debugFile);
             if ($data) {
                 $data = json_decode($data, true);
                 if ($data) {
                     $e = new Exception(json_decode(file_get_contents($debugFile), true), $e->getCode(), $e);
                 }
             }
         }
         throw $e;
     }
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:32,代码来源:TimeDimension.php


示例20: _sendEmay

 /**
  * 亿美短信发送接口
  * @param unknown $mobile 手机号
  * @param unknown $content 短信内容
  */
 private function _sendEmay($mobile, $content)
 {
     set_time_limit(0);
     define('SCRIPT_ROOT', BASE_DATA_PATH . '/api/emay/');
     require_once SCRIPT_ROOT . 'include/Client.php';
     /**
      * 网关地址
      */
     $gwUrl = C('sms.gwUrl');
     /**
      * 序列号,请通过亿美销售人员获取
      */
     $serialNumber = C('sms.serialNumber');
     /**
      * 密码,请通过亿美销售人员获取
      */
     $password = C('sms.password');
     /**
      * 登录后所持有的SESSION KEY,即可通过login方法时创建
      */
     $sessionKey = C('sms.sessionKey');
     /**
      * 连接超时时间,单位为秒
      */
     $connectTimeOut = 2;
     /**
      * 远程信息读取超时时间,单位为秒
      */
     $readTimeOut = 10;
     /**
     $proxyhost		可选,代理服务器地址,默认为 false ,则不使用代理服务器
     $proxyport		可选,代理服务器端口,默认为 false
     $proxyusername	可选,代理服务器用户名,默认为 false
     $proxypassword	可选,代理服务器密码,默认为 false
     */
     $proxyhost = false;
     $proxyport = false;
     $proxyusername = false;
     $proxypassword = false;
     $client = new Client($gwUrl, $serialNumber, $password, $sessionKey, $proxyhost, $proxyport, $proxyusername, $proxypassword, $connectTimeOut, $readTimeOut);
     /**
      * 发送向服务端的编码,如果本页面的编码为GBK,请使用GBK
      */
     $client->setOutgoingEncoding("UTF-8");
     $statusCode = $client->login();
     if ($statusCode != null && $statusCode == "0") {
     } else {
         //登录失败处理
         //    echo "登录失败,返回:".$statusCode;exit;
     }
     $statusCode = $client->sendSMS(array($mobile), $content);
     if ($statusCode != null && $statusCode == "0") {
         return true;
     } else {
         return false;
         print_R($statusCode);
         echo "处理状态码:" . $statusCode;
     }
 }
开发者ID:xuxuecheng,项目名称:shopnc,代码行数:64,代码来源:sms.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Cliente类代码示例发布时间:2022-05-20
下一篇:
PHP CliGuy类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap