當前位置:法律諮詢服務網 - 企業資訊查詢 - php ci框架怎麽對接短信接口

php ci框架怎麽對接短信接口

相當簡單 這個接口調用就是封裝壹個curl請求的function (sendSMS),代碼示例網站上已經有了,使用時:加載這個function, 然後 調用方法sendSMS;

我把源碼給妳貼壹遍,這個裏面的賬號密碼是需要妳們自己去申請的;

<?

$username?=?'test';?//用戶賬號

$password?=?'123456';?//密碼

$mobile?=?'13811299934,18610310066,15210954922';?//號手機碼

$content?=?'您的短信驗證碼是:ABCD';?//內容

//即時發送

$result?=?sendSMS($username,$password,$mobile,$content);

echo?$result;

function?sendSMS($username,$password,$mobile,$content)

{

$url?=?'');

curl_setopt($ch,CURLOPT_POST,1);

curl_setopt($ch,?CURLOPT_POSTFIELDS,$post_fields);

$data?=?curl_exec($ch);

curl_close($ch);

$res?=?explode("\r\n\r\n",$data);

return?$res[2];?

}

>

  • 上一篇:廣東中德高塔肥料有限公司怎麽樣?
  • 下一篇:廣州中遠海運航空貨運代理有限公司電話是多少?
  • copyright 2024法律諮詢服務網