1. 程式人生 > >發簡訊介面獲取驗證碼

發簡訊介面獲取驗證碼

介面合作公司  :http://sms.inolink.com/LoginFront.aspx  從這裡獲取id

<?php

function execPostRequest($url,$fields){
if(empty($url)){ return false;}

//$fields_string =http_build_query($post_array);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');

$ch = curl_init();


curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);


curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);


$result = curl_exec($ch);


curl_close($ch);


return $result;


}


//簡訊介面使用者名稱 $uid
$uid = 'tclkj02234';
//簡訊介面密碼 $passwd
$passwd = '731765';
//傳送到的目標手機號碼 $telphone
$telphone = '1863525****';
//簡訊內容 $message
$message = "這是一條測試資訊111111【XX】";


$fields = array(
'CorpID'=>urlencode($uid),
'Pwd'=>urlencode($passwd),
'Mobile'=>urlencode($telphone),
'Content'=>urlencode($message),
'Cell'=>'',
'SendTime'=>''
       );




$url = "http://inolink.com/WS/BatchSend.aspx";
$result = execPostRequest($url,$fields);


if(0== $result)
{
echo "傳送成功! 傳送時間".date("Y-m-d H:i:s");
}
else
{
    echo "傳送失敗, 錯誤提示程式碼: ".$result;
}


?>

讀過的基本好書 推薦給大家,還有優惠券可以領取: 寄語:在學習方面一定要捨得花錢~ 加油~ -----------------------------------