1.6 调用实例PHP版本

/**
* 发送短信接口
*/

public function http($params){

    $smsConf = $this->getConfigs();

    $url = 'http://www.17int.cn/xxsmsweb/smsapi/send.json';

    $dataArr = array(

        'account' => $smsConf['smsKey'],

        'password' => strtoupper(md5($smsConf['smsPass'])),

        'mobile' => $params['phoneNumber'],

        'content' => $params['content'],

        'requestId' => '11573',

        'extno' => ''

    );

    $dataArr = json_encode($dataArr,JSON_UNESCAPED_UNICODE);

    $return_data = $this->phpCurlPost($url,$dataArr);

    return $return_data;

}

//post 提交

public function phpCurlPost($url,$postStr = "")

{

    $header = array(

        'Content-Type: application/json',

    );

    $curl = curl_init($url);

    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);

    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");

    curl_setopt($curl, CURLOPT_POSTFIELDS, $postStr);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    curl_setopt($curl, CURLOPT_FAILONERROR, false);

    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);

    $response = curl_exec($curl) or die("error:".curl_errno($curl));

    curl_close($curl);

    $result = (array)json_decode($response);

    return $result;

}