This script was working fine for me until I decided to tinker with it today... I edited index.php so it would send me messages longer than 160 characters in multiple SMS's... but I left an infinite loop in there by mistake. It sent me about 200 messages before I was able to stop the cron job. I fixed up the code, but then the script stopped working for me. I can still receive txt messages from other sources, but not from this script. I have even tried replacing it with the original index.php file. Does anyone have any ideas?
Here's my code:
Thanks!
Here's my code:
Code:
<?
include('config.php');
$MC=imap_check($mbox);
$MN=$MC->Nmsgs;
$overview=imap_fetch_overview($mbox,"1:$MN",0);
$size=sizeof($overview);
if($size !="0")
{
$message=imap_fetchbody($mbox, 1, 1);
imap_delete($mbox, 1);
imap_expunge($mbox);
$result = strlen($message);
$message = str_replace(chr(10), " ", $message);
$iterate = intval($result / 160);
$start = 0;
while ($iterate >= 0)
{
if ($result > 160)
{
$cut = substr($message, $start, $start+160);
}
else
{
$cut = $message;
}
$msgtxt = $cut;
$msglength = strlen($msgtxt);
$URL="http://216.129.53.44:8080/cgi-bin/send_sm_rogers.new";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "msisdn=".$smsnum."&text=".$msgtxt."&SIZEBOX=".$msglength);curl_exec ($ch);
curl_close ($ch);
$iterate = $iterate - 1;
$start = $start + 160;
}
}
imap_close($mbox);
?>
Thanks!