當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。