[英]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.