我正在使用 WordPress。我创建了 i.php 文件(短信 API):
<?php
if (isset($_POST['submit'])) {
//Variables to POST
$user = "xxxxxx";
$password = "xxxxxxx";
$mobiles = $_POST['phone'];
$message = $_POST['msg'];
$sender = $_POST['sender'];
//Initialize CURL data to send via POST to the API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://182.18.172.239/sendhttp.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
array('user' => $user,
'password' => $password,
'mobiles' => $mobiles,
'message' => $message,
'sender' => $sender)
);
//Execute CURL command and return into variable $result
$result = curl_exec($ch);
//Do stuff
echo "MESSAGE SENT TO $mobiles FROM $sender. SMS delivery make take upto 10 minutes. If still not getting delivered please send it again. DND or NDNC subscribers will not receive the SMS. To deactivate DND, send STOP DND to 1909";
}
?>
<br><br><br>
<form name='sms' action='' method='post'>
Phone number<br/><input type='text' name='phone' value='' maxlength=12/>
<br/>
Sender ID (from) <br/><input type='text' name='sender' value='' maxlength=15/>
<br/>
Message : <br/><textarea rows=5 cols=30 name='msg'></textarea>
<br/>
<input type='submit' name='submit' value='Send'>
</form>
通过在 sidebar.php 中添加这一行,我已将此文件 (i.php) 包含在我的 WP 主题的 sidebar.php 中
//Including i.php
include_once('i.php');
然后我访问了我的网站,发现只有 HTML 正在执行,而不是 PHP,请在http://androsocial.com/note3上查看
我的服务器中启用了 cURL。
请帮忙。谢谢!