imfaded imfaded - 1 month ago 7
PHP Question

I'm making an API in PHP, but it cannot combine two variables

I am attempting to make an API for an SMS messager in PHP. Everything works and checks out except one thing. It gets the

&carrier
and the
&number
but PHP cannot appear to combine them. Any suggestions? I've attempted debugging it.

The URL is: https://www.swiftresolver.com/sms/api.php?number=number@txt.att.net&from=faded&message=hi&subject=hi&amount=3&carrier=ATT

My whole code:

<br>
<br>
<b>Debugging info:</b>
<br>
<?php
$number = trim(strtolower($_GET['number']));
$from = trim(strtolower($_GET['from']));
$message = trim(strtolower($_GET['message']));
$subject = trim(strtolower($_GET['subject']));
$amount = trim(strtolower($_GET['amount']));
$number2 = $number. "@" .$carrier;
print_r($_GET);
require 'PHPMailerAutoload.php';
switch($_GET['carrier']){
case 'AT&T':
$carrier = "txt.att.net";
break;
case 'Sprint':
$carrier = "messaging.sprintpcs.com";
break;
case 'Verizon':
$carrier = "vtext.com";
break;
case 'T-Mobile':
$carrier = "tmomail.net";
break;
case 'Soufian':
$carrier = "gin.nl";
break;
}
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'swiftserver.ddns.net'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'server@swiftserver.ddns.net'; // SMTP username
$mail->Password = 'xxxxxxx'; // SMTP password
$mail->Port = 25591; //Set the SMTP port number - 587 for authenticated TLS
$mail->setFrom('fbi@fbi.gov',$from); //Set who the message is to be sent fr
$mail->AddAddress($number2); // Name is optional
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = ''.$subject;
$mail->Body = ''.$message;
if ($amount > 50){
print("You can only send 50 messages at a time. Change the message number to 50 and refresh the page.");
}
else if($amount < 50){
for($i=0; $i < $amount; $i++)
{
if(!$mail->send()) {
echo 'Message could not be sent: ';
echo '' . $mail->ErrorInfo;
exit;
}
}
echo 'Your message has been sent ' .$amount;
echo ' time(s).';
}
?>
<html>
<br>
<br>
<br>
<br>


I'm having issues with

$number2 = $number. "@" .$carrier;

Answer Source

Answer on behalf of OP:

In the switch function, I just changed AT&T to ATT.