コード例 #1
0
ファイル: API.php プロジェクト: sunmingyang/wechat
 /**
  * Make a API request.
  *
  * @param string $api
  * @param array  $params
  * @param string $method
  *
  * @return \EasyWeChat\Support\Collection
  */
 protected function request($api, array $params, $method = 'post')
 {
     $params['nonce_str'] = uniqid();
     $params['sign'] = \EasyWeChat\Payment\generate_sign($params, $this->merchant->key, 'md5');
     $options = ['body' => XML::build($params), 'cert' => $this->merchant->get('cert_path'), 'ssl_key' => $this->merchant->get('key_path')];
     return $this->parseResponse($this->getHttp()->request($api, $method, $options));
 }
コード例 #2
0
ファイル: API.php プロジェクト: yuyebin/wechat-sdk
 /**
  * Request with SSL.
  *
  * @param string $api
  * @param array  $params
  * @param string $method
  *
  * @return \EasyWeChat\Support\Collection
  */
 protected function safeRequest($api, array $params, $method = 'post')
 {
     $options = ['cert' => $this->merchant->get('cert_path'), 'ssl_key' => $this->merchant->get('key_path')];
     return $this->request($api, $params, $method, $options);
 }