| @@ 258-282 (lines=25) @@ | ||
| 255 | * @return mixed|string |
|
| 256 | * @links http://www.ucpaas.com/page/doc/doc_rest2-4.jsp |
|
| 257 | */ |
|
| 258 | public function getClientList($appId, $start, $limit, $type = 'json') |
|
| 259 | { |
|
| 260 | $url = self::BaseUrl . self::SoftVersion . '/Accounts/' . $this->accountSid . '/clientList?sig=' . $this->getSigParameter(); |
|
| 261 | if ($type === 'json') { |
|
| 262 | $body_json = array('client' => array( |
|
| 263 | 'appId' => $appId, |
|
| 264 | 'start' => $start, |
|
| 265 | 'limit' => $limit, |
|
| 266 | )); |
|
| 267 | $body = json_encode($body_json); |
|
| 268 | } elseif ($type === 'xml') { |
|
| 269 | $body_xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
|
| 270 | <client> |
|
| 271 | <appId>' . $appId . '</appId> |
|
| 272 | <start>' . $start . '</start> |
|
| 273 | <limit>' . $limit . '</limit> |
|
| 274 | </client>'; |
|
| 275 | $body = trim($body_xml); |
|
| 276 | } else { |
|
| 277 | throw new Exception('只能json或xml,默认为json'); |
|
| 278 | } |
|
| 279 | $data = $this->getResult($url, $body, $type, 'post'); |
|
| 280 | ||
| 281 | return $data; |
|
| 282 | } |
|
| 283 | ||
| 284 | /** |
|
| 285 | * @param $appId |
|
| @@ 462-486 (lines=25) @@ | ||
| 459 | * @return mixed|string |
|
| 460 | * @links http://www.ucpaas.com/page/doc/doc_rest3-2.jsp |
|
| 461 | */ |
|
| 462 | public function voiceCode($appId, $verifyCode, $to, $type = 'json') |
|
| 463 | { |
|
| 464 | $url = self::BaseUrl . self::SoftVersion . '/Accounts/' . $this->accountSid . '/Calls/voiceCode?sig=' . $this->getSigParameter(); |
|
| 465 | if ($type === 'json') { |
|
| 466 | $body_json = array('voiceCode' => array( |
|
| 467 | 'appId' => $appId, |
|
| 468 | 'verifyCode' => $verifyCode, |
|
| 469 | 'to' => $to, |
|
| 470 | )); |
|
| 471 | $body = json_encode($body_json); |
|
| 472 | } elseif ($type === 'xml') { |
|
| 473 | $body_xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
|
| 474 | <voiceCode> |
|
| 475 | <verifyCode>' . $verifyCode . '</clientNumber> |
|
| 476 | <to>' . $to . '</charge> |
|
| 477 | <appId>' . $appId . '</appId> |
|
| 478 | </voiceCode>'; |
|
| 479 | $body = trim($body_xml); |
|
| 480 | } else { |
|
| 481 | throw new Exception('只能json或xml,默认为json'); |
|
| 482 | } |
|
| 483 | $data = $this->getResult($url, $body, $type, 'post'); |
|
| 484 | ||
| 485 | return $data; |
|
| 486 | } |
|
| 487 | ||
| 488 | /** |
|
| 489 | * @param $appId |
|