0
对不起,但我不知道如何清楚地询问这个问题。如何返回url操作的结果
$user = User::find(session('user_id'));
$api_user = 'USERAPI';
$api_password = 'USERPASSWORD';
$sms_from = 'KOLOS';
$sms_to = $user->phone;
$sms_msg = 'Your verification code is '. $user->phone_validation.'.';
//$this->sendCode($api_user,$api_password,$sms_from,$sms_to,$sms_msg); // callback
//$user = User::find(session('user_id'));
$query_string = "api.aspx?apiusername=".$api_user."&apipassword=".$api_password;
$query_string .= "&senderid=".rawurlencode($sms_from)."&mobileno=".rawurlencode($sms_to);
$query_string .= "&message=".rawurlencode(stripslashes($sms_msg)) . "&languagetype=1";
$url = "http://gateway.onewaysms.co.id:10002/".$query_string;
$arr = array($url);
$fd = implode(',', $arr);
if ($fd) {
if ($fd >= 0) {
Print("MT ID : " . $fd);
$ok = "success";
} else {
print("Please refer to API on Error : " . $fd);
$ok = "fail";
}
} else {
// no contact with gateway
$ok = "fail. No contact";
}
此代码段在我的本地主机上正常工作,但没有在我的godaddy主机上工作。另外,如果我直接转到网址,它会发送短信。请有人告诉我这里的代码有什么问题。
从我的标题我有一个想法,但不知道如何去的URL,然后回到我的应用程序的结果。
非常感谢。
使用CURL。阅读它。 –
使用GuzzleHttp:http://docs.guzzlephp.org/en/latest/ –