| @@ 55-72 (lines=18) @@ | ||
| 52 | * @return string $result[].msg 返回消息 |
|
| 53 | * @return mixed $result[].verifyCode 验证码 |
|
| 54 | */ |
|
| 55 | protected function curl($url, $postData) |
|
| 56 | { |
|
| 57 | $ch = curl_init(); |
|
| 58 | curl_setopt($ch, CURLOPT_URL, $url); |
|
| 59 | curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
|
| 60 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); |
|
| 61 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
|
| 62 | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
|
| 63 | curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); |
|
| 64 | curl_setopt($ch, CURLOPT_USERPWD, $this->apiKey); |
|
| 65 | curl_setopt($ch, CURLOPT_POST, TRUE); |
|
| 66 | curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); |
|
| 67 | $httpResponse = $this->httpResponse($ch); |
|
| 68 | $result = $this->transformerResponse($httpResponse); |
|
| 69 | curl_close($ch); |
|
| 70 | ||
| 71 | return $result; |
|
| 72 | } |
|
| 73 | ||
| 74 | protected function transformerResponse($httpResponse) |
|
| 75 | { |
|
| @@ 76-93 (lines=18) @@ | ||
| 73 | * @return string $result[].msg 返回消息 |
|
| 74 | * @return mixed $result[].verifyCode 验证码 |
|
| 75 | */ |
|
| 76 | protected function curl($url, $postData) |
|
| 77 | { |
|
| 78 | $ch = curl_init(); |
|
| 79 | curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
| 80 | curl_setopt($ch, CURLOPT_URL, $url); |
|
| 81 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); |
|
| 82 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
| 83 | curl_setopt($ch, CURLOPT_HEADER, 0); |
|
| 84 | curl_setopt($ch, CURLOPT_POST, true); |
|
| 85 | curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); |
|
| 86 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
| 87 | curl_setopt($ch, CURLOPT_HTTPHEADER, $this->header); |
|
| 88 | $httpResponse = $this->httpResponse($ch); |
|
| 89 | $result = $this->transformerResponse($httpResponse); |
|
| 90 | curl_close($ch); |
|
| 91 | ||
| 92 | return $result; |
|
| 93 | } |
|
| 94 | ||
| 95 | protected function transformerResponse($httpResponse) |
|
| 96 | { |
|