我想将SMS集成到我的API并尝试在URL中传递变量,但它表示错误,没有找到数字。
请帮忙
$sender = "9999708993";
$reply_message = "This is an auto generated message";
echo $sender;
echo $reply_message;
$lines = file_get_contents('http://sms2.oxyzen.in/httpapi/sendsms.php?loginid=myid&password=mypassword&senderid=mysenderid&message=$reply_message&number=$sender');
echo "<pre>$lines</pre>";
答案 0 :(得分:4)
$lines = file_get_contents("http://sms2.oxyzen.in/httpapi/sendsms.php?loginid=myid&password=mypassword&senderid=mysenderid&message=$reply_message&number=$sender");
请试试这个:
$sender = "9999708993";
$reply_message = urlencode("This is an auto generated message");
//I think you need to change these
$loginid='myid';
$mypassword='mypassword';
$mysenderid='mysenderid';
$uri = "http://sms2.oxyzen.in/httpapi/sendsms.php?loginid=$myid&password=$mypassword&senderid=$mysenderid&message=$reply_message&number=$sender";
var_dump($uri);
$lines=file_get_contents($uri);
var_dump($lines);
答案 1 :(得分:0)
尝试清除该URL,它的结尾可能会有一个新行 trim(“ $ URL”);