thinphp做发送短信功能?

WBOY
Lepaskan: 2016-08-25 10:37:12
asal
1128 orang telah melayarinya

用thinphp来做一个短信发送功能?短信发送接口是阿里大于的接口!
程序是

<code>    $appkey = "2344130587";
    $secret = "8d91dcf2073ff6da30bddbc";
    
    require THINK_PATH.'Library/Org/Taobao/top/TopClient.php';
    require THINK_PATH.'Library/Org/Taobao/top/ResultSet.php';
    require THINK_PATH.'Library/Org/Taobao/top/RequestCheckUtil.php';
    require THINK_PATH.'Library/Org/Taobao/top/TopLogger.php';
    require THINK_PATH.'Library/Org/Taobao/top/request/AlibabaAliqinFcSmsNumSendRequest.php';
    include(THINK_PATH.'Library/Org/Taobao/TopSdk.php');
    
    $c = new \TopClient;
    $c->format = "json";
    $c->appkey = $appkey;
    $c->secretKey = $secret;
    $req = new \AlibabaAliqinFcSmsNumSendRequest;
    //$req->setExtend("123456");
    $req->setSmsType("normal");
    $req->setSmsFreeSignName("短信测试");
    $req->setSmsParam('{"code":"123456"}');
    $req->setRecNum("159143333346");
    $req->setSmsTemplateCode("SMS_8525079");
    $resp = $c->execute($req);
    dump($resp);
    

打印出来是

object(ResultSet)#8 (2) {["code"] => int(0) ["msg"] => string(28) "Could not resolve proxy: ddd"}
请教一下各位大神哪里错了?</code>
Salin selepas log masuk
Salin selepas log masuk

回复内容:

用thinphp来做一个短信发送功能?短信发送接口是阿里大于的接口!
程序是

<code>    $appkey = "2344130587";
    $secret = "8d91dcf2073ff6da30bddbc";
    
    require THINK_PATH.'Library/Org/Taobao/top/TopClient.php';
    require THINK_PATH.'Library/Org/Taobao/top/ResultSet.php';
    require THINK_PATH.'Library/Org/Taobao/top/RequestCheckUtil.php';
    require THINK_PATH.'Library/Org/Taobao/top/TopLogger.php';
    require THINK_PATH.'Library/Org/Taobao/top/request/AlibabaAliqinFcSmsNumSendRequest.php';
    include(THINK_PATH.'Library/Org/Taobao/TopSdk.php');
    
    $c = new \TopClient;
    $c->format = "json";
    $c->appkey = $appkey;
    $c->secretKey = $secret;
    $req = new \AlibabaAliqinFcSmsNumSendRequest;
    //$req->setExtend("123456");
    $req->setSmsType("normal");
    $req->setSmsFreeSignName("短信测试");
    $req->setSmsParam('{"code":"123456"}');
    $req->setRecNum("159143333346");
    $req->setSmsTemplateCode("SMS_8525079");
    $resp = $c->execute($req);
    dump($resp);
    

打印出来是

object(ResultSet)#8 (2) {["code"] => int(0) ["msg"] => string(28) "Could not resolve proxy: ddd"}
请教一下各位大神哪里错了?</code>
Salin selepas log masuk
Salin selepas log masuk

看提示信息是无法解析代理:ddd。不用tp,直接用官网提供的demo能发吗?

<code>$appkey = "2344130587";
$secret = "8d91dcf2073ff6da30bddbc";</code>
Salin selepas log masuk
Label berkaitan:
php
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan