[英]sending sms through javascript command because curl is not working on server?
[英]php with curl sms sending with on live server
function curl_request($url=false)
{
$ch=curl_init();
if($url)
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_USERAGENT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $result;
}
$data['update']=false;
$data['msg']='Record not found.';
switch($_POST['action'] ){
case "validateAccountNumber" :
$sql="SELECT user_id FROM tbl_user WHERE ".$_POST['fieldName']."='".$_POST['fieldValue']."'";
$result = mysql_query ($sql);
if(mysql_num_rows($result)){
$_SESSION['account_no'] = $_POST['fieldValue'];
$data['update']=true;
$data['msg']='Record found.';
}
break;
case "validateMobileNumber" :
$sql="SELECT user_id FROM tbl_user WHERE ".$_POST['fieldName']."='".$_POST['fieldValue']."' AND account_no='".$_SESSION['account_no']."'";
$result = mysql_query ($sql);
if(mysql_num_rows($result)){
$_SESSION['mobile_no'] = $_POST['fieldValue'];
//
$sms_code= makePin();
$_SESSION['sms_code'] = $sms_code;
///////////////////// Sengin Sms Code //////////////////////////
$message = "Dear Member, your activation code is $sms_code. Thanks for registering, from www.chsonline.in.";
$username = "xxxxxxxxxx";
$password = "zzzzzzzzzz";
$sendername = "chsonline";
$url = "http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=".$username."&password=".$password."&sendername=".$sendername."&mobileno=91".$_SESSION['mobile_no']."&message=".urlencode($message);
$data['sms_response'] = curl_request($url);
$data['sms'] = $url;
////////////////////////////////////////////////////////////////
$data['update']=true;
$data['msg']='A verification code have been sent in your mobile no.';
}
break;
default:
break;
}
echo json_encode($data);
die();
}
这是一个php代码:当我使用此代码发送短信时,它在localhost上发送短信,但在实时服务器上,它不仅发送短信,而且此通知还提供
代码执行正确,但没有短信发送。 我在Godaddy.in的托管或域名
请与您的托管公司联系以启用curl功能,或者不与您选择的托管计划有关。 似乎在您的服务器上CURL
已禁用。
您可以检查php.ini配置是否相同。
要检查php信息:
在服务器上创建文件phpinfo.php
把<?php echo phpinfo();?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.