Boa tarde, gostaria de saber como faço um loop em PHP, preciso que ele execute o seguinte codigo até acabar os numeros
index.html
OpenVox HTTP SMS API Demo Show<link rel="stylesheet" href="css/style.css" media="screen" type="text/css" />
<body>
<form action="sendsms.php" method="post" target=reportwin
onsubmit="window.open ('', 'reportwin', 'height=100, width=768, top=350, left=350, toolbar=no,menubar=no, scrollbars=no, resizable=no, location=no, status=no')";>
<div id="main-container">
<div id="left-container"> <!-- Left part -->
<div id="newPost" class="container"> <!-- Add New Post -->
<div class="side bar">
<ul>
<li><a href=""><span class="fontawesome-dashboard"></span></a></li>
<li><a href=""><span class="fontawesome-file-alt"></span></a></li>
<li><a href=""><span class="fontawesome-picture"></span></a></li>
<li><a href=""><span class="entypo-link"></span></a></li>
<li><a href="" id="document"><span class="fontawesome-comments"></span></a></li>
</ul>
</div>
<div class="newPostContent">
<h1>SMS Sender</h1>
<input type="text" placeholder="IP or Domain of SMS Gateway" name="ip" id="post-title">
<input type="text" placeholder="Destination Phone Number" name="phonenumber" id="post-title">
<div class="format-bar bar">
<ul>
<li><a href=""><span class="fontawesome-bold"></span></a></li>
<li><a href=""><span class="fontawesome-italic"></span></a></li>
<li><a href=""><span class="fontawesome-underline"></span></a></li>
<li><a href=""><span class="fontawesome-strikethrough"></span></a></li>
<li><a href=""><span class="fontawesome-list-ul"></span></a></li>
<li><a href=""><span class="fontawesome-list-ol"></span></a></li>
</ul>
</div>
<textarea placeholder="Input SMS Content Here" name="message" class="post-body"></textarea>
<!-- <a href="sendsms.php" class="btn">Send</a> -->
<!-- <input type="submit" Value="Send" class="btn"></input> -->
<input type="submit" Value="Send" class="btn"></input>
<input type="botton" onclick="openwin()" Value="Receive" class="btn"></input>
<!-- <a href="receivesms.php" class="btn">Receive</a> -->
</div>
</div>
</div>
</form>
</div>
</body>
receivesms.php
<?php echo 'SMS2HTTP Inbox Demo
';
@$num = $_GET['num'];
@$port = $_GET['port'];
@$message = $_GET['message'];
@$time = $_GET['time'];
$message = str_replace("\r\n", "
", $message);
$Begin = "-----------------------------------Received Message------------------------------
";
$Message = "Message:
".$message."
";
$MyPhonenumber = "From:".$num."
";
$MyPort = "Port:".$port."
";
$MyTime = "Time:".$time."
";
$MyStr = $Begin.$MyTime.$MyPhonenumber.$MyPort.$Message."
";
if(!empty($num))
{
$file_pointer = fopen("message.txt","a+");
fwrite($file_pointer,$MyStr);
fclose($file_pointer);
}
$content = file_get_contents("message.txt");
echo $content;
echo "
";
?>
sendsms.php
<?php function sendSMS($ip,$phonenumber,$message) { $username = "smsuser"; $password = "smspwd"; //$port = ""; //$report = ""; //$timeout = ""; $message =urlencode(mb_convert_encoding($message, 'utf-8', "auto")); $url = "http://$ip/sendsms?username=$username&password=$password&phonenumber=$phonenumber&message=$message"; $link = curl_init(); curl_setopt($link, CURLOPT_HEADER, 0); curl_setopt($link, CURLOPT_RETURNTRANSFER, 1); curl_setopt($link, CURLOPT_URL, $url); $response = curl_exec($link); curl_close($link); $response = str_replace("\r\n", "\\r\\n", $response); $array = json_decode($response, true); //var_dump($array); $report = $array['report'][0]['1'][0]['result']; if ($report == "success") { echo 'SMS Sent successfully!
'; } elseif ($report == "sending") { echo '
SMS is sending, please check later!
'; } else { echo '
SMS is failed, please check your device or settings!
';
echo "
";
}
}
$ip = $_POST["ip"];
$phonenumber = $_POST["phonenumber"];
$message = $_POST["message"];
sendSMS($ip,$phonenumber,$message);