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


PHP HttpClient::setParameter方法代码示例

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


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

示例1: send

 /**
  * to config content data and send to target
  * @param array $data - content data in array
  *	(format like array(
  *		"first"=>array("value"=>"","color"=>""), 
  *		"remark"=>array("value"=>"","color"=>""))
  *	)
  * @return data received after posting
  */
 public function send($data)
 {
     $this->body['data'] = $data;
     $json = json_encode($this->body);
     $client = new HttpClient("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={$this->access_token}");
     $client->setParameter($json);
     return $client->post();
 }
开发者ID:jianhua1982,项目名称:wlight,代码行数:17,代码来源:template.php

示例2: send

 public function send($content)
 {
     $data = array("touser" => $this->openid, "msgtype" => "text", "text" => array("content" => urlencode($content)));
     $data = urldecode(json_encode($data));
     $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$this->access_token}";
     $client = new HttpClient($url);
     $client->setParameter($data);
     return $client->post();
 }
开发者ID:jianhua1982,项目名称:wlight,代码行数:9,代码来源:custom.php

示例3: create

 public function create($statement)
 {
     $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$this->access_token}";
     if (is_array($statement)) {
         include dirname(__FILE__) . '/../util/arr_urlencode.php';
         $statement = arr_urlencode($statement);
         $statement = urldecode(json_encode($statement));
     }
     $client = new HttpClient($url);
     $client->setParameter($statement);
     return $client->post();
 }
开发者ID:jianhua1982,项目名称:wlight,代码行数:12,代码来源:menu.php

示例4: get

 /**
  * to get the short url by transforming
  * @param string $url - long url
  * @return string - short url (or boolean false if fail)
  */
 public function get($url)
 {
     if ($this->access_token) {
         $client = new HttpClient("https://api.weixin.qq.com/cgi-bin/shorturl?access_token={$this->access_token}");
         $client->setParameter(array('action' => 'long2short', 'long_url' => $url));
         $stream = json_decode($client->post());
         if (isset($stream->short_url)) {
             return $stream->short_url;
         }
     }
     return false;
 }
开发者ID:jianhua1982,项目名称:wlight,代码行数:17,代码来源:url_transform.php


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