php - the curl link is not sent -
create message function not working form execute need go sms api link , not getting called please me fix this
<?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 @ '.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! 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 tata innova website"; $user="demo";//don't change thing $password = "demopass";//don't change thing $from = "nandhi"; // //don't change thing - sender id $to = "9566376463""; // ph# txt message sent $fields = array( ///url details sending... 'user' => urlencode($user), 'password' => urlencode($password), 'phone' => urlencode($to), 'text' => urlencode($message), 'type' => 't', 'senderid' => urlencode($from), ); foreach($fields $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 interest in our offer. request has been forwarded us.<br>"; $body .= "we deal , contact possible in contact you.<br><br>"; $body .= "for further questions happy 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 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'; // }
code on heredgdgdgdg code on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdgcode on heredgdgdgdg
please check createmessage function. have corrected 2 lines $message = $_post['first-name'] , $to = "9566376463"; // ph# txt message sent to
<?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 @ '.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! 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 ".$_post['selected-car']."contact :".$_post['phone-number']; //$message = $_post['first-name']. "booked tata innova website"; //corrected string $user="demo";//don't change thing $password = "demopass";//don't change thing $from = "nandhi"; // //don't change thing - sender id $to = "9566376463"; // ph# txt message sent //corrected double quote $fields = array( ///url details sending... 'user' => urlencode($user), 'password' => urlencode($password), 'phone' => urlencode($to), 'text' => urlencode($message), 'type' => 't', 'senderid' => urlencode($from), ); foreach($fields $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 interest in our offer. request has been forwarded us.<br>"; $body .= "we deal , contact possible in contact you.<br><br>"; $body .= "for further questions happy 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 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'; // }
Comments
Post a Comment