Script to Load a list of #'s To Send a Msg To

create a new file called smstext2.php. Put this code in it and bring it up in a browser.
See if it displays the numbers or not. We need to debug it step by step.

<?php
    //  Open the text file.
    $numbers_file = fopen("textfile.txt", "r");

    //  Read one line at a time ( one phone number per line )
    while (($phone_number = fgets($numbers_file)) !== false) {
           echo $phone_number . "<br>";
   }
    //  Close the file
        fclose($numbers_file);
?>

Yes this did display the phone numbers, all 3 of them

Okay, in that case, we will have to rewrite my code using the version you posted.
I will post it in a bit once I sort it out…

I can’t thank you enough. Once again I hope we can discuss an option where you would be open to consulting for us in the future.

Try this version. I was reading your details and this service does not allow more than one call per second and they do not allow sending the same message to large number of phones. Therefore, you might need to add some sort of reference number inside the message so that the message is different each time. Not sure at all on this…

<?php
if (isset($_POST["submit"])) {
    //  Open the text file.   ( HERE YOU WOULD NEED TO CHANGE THE NAME OF THE FILE TO YOUR FILENAME ! ! ! )
    $numbers_file = fopen("inputfile.txt", "r");

    //  Read one line at a time ( one phone number per line )
    while (($phone_number = fgets($numbers_file)) !== false) {
        //  Process the one phone number, create the URL paramenters with info in the correct places
        $url_parms = "?token=e9cf7e33-0c00-4eb5-94fb-7ae060fa4329&source=8445972807&destination=" . trim($phone_number) . "&message='This is The National Health Enrollment Center. You are still eligible to enroll in an affordable health insurance plan. Call 844-597-2807 now to speak with a licensed agent.'";

        //  Using the created URL, send it using Curl
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,"https://sms.teleapi.net/sms/send");
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $url_parms);

        // Send message and receive server response ...
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);
        $response = json_decode($response);
        if ($response->code == 200) {
            echo "SMS sent out to: " . $trim($phone_number) . "<br>";
        } else {
            echo "ERROR sending SMS to: " . $trim($phone_number) . "<br>";
        }

        //  To not cause issues with the server being overwhelmed, delay one second between SMS' .   This might be able to be lowered.
        sleep(1);
    }

    //  Close the file
        fclose($numbers_file);
}
?>
 <!DOCTYPE html>
<html>
<body>

<h1>Send SMS messages to all numbers in text file</h1>
<input type="submit" name="submit" value="send_now" />

</body>
</html>

I changed the error reporting section and also added quotes on your message as I think that might be a problem. Good luck…

It’s still not working. I’m not sure that the “Send Now” button is doing anything… I wonder if we can run this just by taking that button out? Btw it’s not that they it won’t let you send those texts that fast or what have you, it’s that they will stop the account and flag it as spam if you do. We have already spoken with the company and gotten the go ahead though…

Once again, this page has been uploaded to the same folder with all the same options and unfortunately is still not doing anything. No error codes or nothing.

Oh, RATS! It must be inside a form to post. My fault… Change the bottom part to:

<!DOCTYPE html>
<html>
<body>
    <form action="#" method="post"> 
        <h1>Send SMS messages to all numbers in text file</h1>
        <input type="submit" name="submit" value="send_now" />
    </form>
</body>
</html>

VERY VERY sorry about that! Typed the original off the top of my mind and did not test…

Also, you should probably place all of the PHP code inside of the form area after the input so that it displays the output on the live page. So, all the PHP code would be between the <input tag and the </form tag…

have done everything you said and have successfully (with the echo script) received back a “Processing: 8134813879”

And that’s where it all stops LOL. It doesn’t show that it processes any other numbers and also I didn’t receive a text.

Sorry I got delayed again. Perhaps there is an email you could private message me on or can I pay to not be restricted?

You don’t have to pay, we will solve it for free. I have also been extremely busy. We just need to debug the code to see what it is doing wrong. I can test it from here since you have included your token in the post’s.

I will do so later today as I am working right now. I think we are close. Talk to you a little later in my day.

I’m really curious about this. Where are you restricted, because it sounds like you are saying you are restricted to posting in the forum?

Exactly. I can only post so many times before I get restricted. Essentially when I meet the limit I go to type in my reply and when I click reply to send it it explains that I have hit a limit and can post again in six hours

Steve, there is no time limit on posting here. Are you using a regular computer to post here with?
And, what country are you in?

Yes it’s a regular computer with Windows 10 and I live in Florida, Orlando in fact. But it restricts me from posting for 6 hours when I reach the limit. trust me it’s not my imagination and I certainly don’t want to waste replies if I can help it, so that’s why I asked if I could get your email so if I get restricted again I can at least email you and let you know what’s going on.

This one is sent from my phone and it just did it so I took a snapshot to show you what it looks like. But it does it on both my computer and my phone

It says six MINUTES, not six HOURS… LOL

Anyway, I will look over the script again later today. I’m EST also, but, have a lot of work today.
I think it is something to do with the posting section of the code. I will debug it for you.

That’s just one. One time it was for 29 minutes, 2 times it was for 6 hours.

Either way good news I got it to work with this script right here by following a few steps on the site that I couldn’t see before

Thanks for all the help and support!

Great! Glad we could help!

I upgraded your account. That may have something to do with it. We are still trying to figure out the new forum software.

Sponsor our Newsletter | Privacy Policy | Terms of Service