gpt4 book ai didi

javascript - 带有 curl 短信的 php 在实时服务器上发送

转载 作者:行者123 更新时间:2023-11-30 22:39:16 24 4
gpt4 key购买 nike

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 信息:

  1. 在服务器上创建文件 phpinfo.php

  2. 输入 <?php echo phpinfo();?>

  3. 在服务器上运行 phpinfo.php 文件
  4. 找到 curl 并检查它是启用还是禁用?

关于javascript - 带有 curl 短信的 php 在实时服务器上发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31535574/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com