卷发链接未发送

时间:2015-07-14 15:44:38

标签: php curl

创建消息功能无效 这是形式执行 那需要去那个短信api链接 现在它没有被调用请帮我解决这个问题

<?php 

include_once('inc/class.simple_mail.php');
include_once('inc/gump.class.php');

include_once('mail-config.php');



// Check Data
$isValid = GUMP::is_valid($_POST, array(
	'first-name' => 'required',
	'last-name' => 'required',
	'phone-number' => 'required',
	'email-address' => 'required|valid_email',
	'address' => 'required',
	'city' => 'required',
	'zip-code' => 'required',
	));
	

if($isValid === true) {

	// Submit Mail
	$mail = new SimpleMail();
	$mail->setTo(YOUR_EMAIL_ADDRESS, YOUR_COMPANY_NAME)
	->setSubject('New car rental request')
	->setFrom(htmlspecialchars($_POST['email-address']), htmlspecialchars($_POST['first-name'].' '.$_POST['last-name']))
	->addGenericHeader('X-Mailer', 'PHP/' . phpversion())
	->addGenericHeader('Content-Type', 'text/html; charset="utf-8"')
	->setMessage(createMessage($_POST))
	->setWrap(100);

	$mail->send();


	// Submit Client Mail
	$mailClient = new SimpleMail();
	$mailClient->setTo(htmlspecialchars($_POST['email-address']), htmlspecialchars($_POST['first-name'].' '.$_POST['last-name']))
	->setSubject('Youre car rental request at '.YOUR_COMPANY_NAME)
	->setFrom(YOUR_EMAIL_ADDRESS, YOUR_COMPANY_NAME)
	->addGenericHeader('X-Mailer', 'PHP/' . phpversion())
	->addGenericHeader('Content-Type', 'text/html; charset="utf-8"')
	->setMessage(createClientMessage($_POST))
	->setWrap(100);

	$mailClient->send();

	$result = array(
		'result' => 'success', 
		'msg' => array('Success! Your contact request has been send.')
		);

	echo json_encode($result);

} else {
	$result = array(
		'result' => 'error', 
		'msg' => $isValid
		);

	echo json_encode($result);
}


function createMessage($formData)
{
						$message   = "$_POST['first-name']. Booked a Tata Innova From Website";
						$user="demo";//don't change this thing
						$password = "demopass";//don't change this thing
						$from      = "NANDHI";   // //don't change this thing - Sender ID
						$to        = "9566376463"";   // Ph# txt message is sent to
						
						
						$fields = array( ///URL Details that you are sending... 
						 'user' 	=> 	urlencode($user),
						 'password' => 	urlencode($password),
						 'phone'    =>	urlencode($to),
						 'text'     =>	urlencode($message),
						 'type' 	=> 	't',
						 'senderid' =>	urlencode($from),
					    );
						
						foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
						rtrim($fields_string,'&');
						$url       = 'http://login.redsms.in/API/SendMessage.ashx?'.$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);

						$result = curl_exec($ch);
						curl_close($ch);
}

function createClientMessage($formData)
{
	$body  = 	"Hello ".htmlspecialchars($formData['first-name'])." ".htmlspecialchars($formData['last-name'])."<br><br>";
	$body .=	"We appreciate your interest in our offer. Your request has been successfully forwarded to us.<br>";
	$body .=	"We will deal with it immediately and contact you as soon as possible in contact with you.<br><br>";
	$body .=	"For further questions we are happy to help! <br><br>";
	$body .=	"Best regards<br>".YOUR_COMPANY_NAME;


	return $body;
}






















// $mail = new SimpleMail();
// $mail->setTo('mail@themeinjection.com', 'Your Email')
// ->setSubject('Test Message')
// ->setFrom('no-reply@domain.com', 'Domain.com')
// ->addMailHeader('Reply-To', 'no-reply@domain.com', 'Domain.com')
// ->addMailHeader('Cc', 'bill@example.com', 'Bill Gates')
// ->addMailHeader('Bcc', 'steve@example.com', 'Steve Jobs')
// ->addGenericHeader('X-Mailer', 'PHP/' . phpversion())
// ->addGenericHeader('Content-Type', 'text/html; charset="utf-8"')
// ->setMessage('<strong>This is a test message.</strong>')
// ->setWrap(100);
//$send = $mail->send();
//echo ($send) ? 'Email sent successfully' : 'Could not send email';


//echo json_encode(array('data' => 'test data'));

/* AJAX check  */
// if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
// 	echo json_encode(array('data' => 'test data'));
// }
// else
// {
// 	echo 'no ajax';
// }

代码超过heredgdgdgdg 码过过过过heredgdgdgdgcode过heredgdgdgdgcode heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode heredgdgdgdgcode过heredgdgdgdgcode过heredgdgdgdgcode超过heredgdgdgdg

1 个答案:

答案 0 :(得分:0)

请检查createMessage函数。我更正了两行$ message = $ _POST ['first-name']和$ to =“9566376463”; // Ph#txt消息发送到

> p <- ggplot(mtcars,aes(x = mpg,y = disp,size = cyl)) + geom_point()
> p + scale_size_continuous(guide = guide_legend(override.aes = list(colour = "red")))