我正在尝试使用save\\u post挂钩向PODS自定义帖子类型中输入的电话号码发送短信。保存记录时应发送短信。
add_action( \'save_post_appointment\', \'sendsms_save\' );
function sendsms_save() {
$username = \'username\';
$password = \'password\';
$msisdn = $_POST["mobile"];
$content="Hi";
$data = "username=".$username."&password=".$password."&message=".urlencode($content)."&msisdn=".urlencode($msisdn);
$ch = curl_init(\'http://bulksms.com/eapi/submission/send_sms/2/2.0\');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($response = curl_exec($ch))
{
echo "1";
}
else
{
echo "0";
}
curl_close ($ch);
}
当您连接到save\\u POST时,$\\u POST数据可用吗?还是我必须选择最新的记录才能获得电话号码?