怎样用接口,php源码,求....

解决方案 »

  1.   

     function sendsms($tel,$msg)
    {
     $cdkey = '7SD-LHW-8888JBRTP'; // 注册序列号
     $password = '1234566'; // 密码  
     if(!$tel || !$msg || !$cdkey || !$password) return false;
     
     if(is_array($tel)) $tel = implode(",",$tel);
     
     /*  utf8需要转码
     $content = iconv("utf-8","gbk//ignore",$content);
     **/
     $msg = urlencode($msg);
     $api="http://sdk.utysd.com.cn:120/sdkproxy/sendsms.action?cdkey=$cdkey&password=$password&phone=$tel&message=$msg&addserial=";
     $res = file_get_contents($api);
     return strpos($res,'success') === false ? $res : true;
    }
      

  2.   

    THINKPHP/*
    发送短信
    http://sms.webchinese.cn/api.shtml
    */
    function sendSMS($phone,$msg){
    header("Content-Type:text/plain;charset=utf-8");
    import("ORG.Net.Http");
    $url = "http://utf8.sms.webchinese.cn/?Uid=".C('SMS_USER')."&Key=".C('SMS_KEY')."&smsMob=$phone"."&smsText=".urlencode($msg);
    $result = http::fsockopen_download($url);
    return $result>0;
    }