|
2 | 2 |
|
3 | 3 | namespace Omnipay\WechatPay\Message;
|
4 | 4 |
|
| 5 | +use GuzzleHttp\Client; |
5 | 6 | use Omnipay\Common\Exception\InvalidRequestException;
|
6 | 7 | use Omnipay\Common\Message\ResponseInterface;
|
7 | 8 | use Omnipay\WechatPay\Helper;
|
@@ -106,18 +107,16 @@ public function setKeyPath($keyPath)
|
106 | 107 | */
|
107 | 108 | public function sendData($data)
|
108 | 109 | {
|
109 |
| - $options = array( |
110 |
| - CURLOPT_SSL_VERIFYPEER => true, |
111 |
| - CURLOPT_SSL_VERIFYHOST => 2, |
112 |
| - CURLOPT_SSLCERTTYPE => 'PEM', |
113 |
| - CURLOPT_SSLKEYTYPE => 'PEM', |
114 |
| - CURLOPT_SSLCERT => $this->getCertPath(), |
115 |
| - CURLOPT_SSLKEY => $this->getKeyPath(), |
116 |
| - ); |
117 |
| - |
118 | 110 | $body = Helper::array2xml($data);
|
119 |
| - $request = $this->httpClient->request('POST', $this->endpoint, $options, $body); |
120 |
| - $response = $request->getBody(); |
| 111 | + $client = new Client(); |
| 112 | + |
| 113 | + $options = [ |
| 114 | + 'body' => $body, |
| 115 | + 'verify' => true, |
| 116 | + 'cert' => $this->getCertPath(), |
| 117 | + 'ssl_key' => $this->getKeyPath(), |
| 118 | + ]; |
| 119 | + $response = $client->request('POST', $this->endpoint, $options)->getBody(); |
121 | 120 | $responseData = Helper::xml2array($response);
|
122 | 121 |
|
123 | 122 | return $this->response = new QueryTransferResponse($this, $responseData);
|
|
0 commit comments