我用一个联系表7的形式赶上在现场电话用户的电话号码给他发一个短信提醒,这样的:联系表格7到PHP SMS发送
<p>Your phone number<br />
[text* phone] </p>
<p>[submit "Send"]</p>
在我的WordPress主题的功能,我那么有以下几点:
add_action('wpcf7_mail_sent', 'your_wpcf7_mail_sent_function');
function your_wpcf7_mail_sent_function($contact_form) {
$title = $contact_form->title;
$posted_data = $contact_form->posted_data;
if ('smsservice' == $title) {
$phone = $posted_data['phone'];
require_once 'http://myurl.com/smsservice/send_sms.php';
}
}
和链接send_sms.php我:
# Modify these values to your needs
$username = 'myusername';
$pass = 'mypassword';
$gateway_url = 'api-adress';
$utf8_message_text = "This is a test sms!";
$recipientAddressList = array['$phone']
$maxSmsPerMessage = 1;
$test = false; // true: do not send sms for real, just test interface
try {
// 1.) -- create sms client (once) ------
$smsClient = new WebSmsCom_Client($username, $pass, $gateway_url);
//$smsClient->setVerbose(true);
// 2.) -- create text message ----------------
$message = new WebSmsCom_TextMessage($recipientAddressList, $utf8_message_text);
//$message = binary_sms_sample($recipientAddressList);
// 3.) -- send message ------------------
$Response = $smsClient->send($message, $maxSmsPerMessage, $test);
然而,EAC当我填写表格时,它什么都不做。甚至没有发送表格。但是,从PHP代码我似乎无法找到一个错误。其他人?
最好的问候, 勒布