當前位置:編程學習大全網 - 網站源碼 - 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];?

}

>

  • 上一篇:客戶服務erp系統源代碼
  • 下一篇:下周買太極集團怎麽樣?或者大師有什麽建議?
  • copyright 2024編程學習大全網