Jump to content
ronsen

PHP Help with variables

Recommended Posts

Hello

I am stuck at a point where I need to call multiple numbers for a given API

 

This is the  code provided by the API company

// Send Message
$my_apikey = "APIKEY";
$destination = "NUMBER";
$message = "hellotest";
$api_url = "http://blahblah.com/send_message.php";
$api_url .= "?apikey=". urlencode ($my_apikey);
$api_url .= "&number=". urlencode ($destination);
$api_url .= "&text=". urlencode ($message);
$my_result_object = json_decode(file_get_contents($api_url, false));

 

Now My html code would be

 

<div class="card-header ch-alt">
        <h2>Test API</h2>
    </div>

    <div class="card-body card-padding">
        API Key: * <br>

         <option value='APIKEY'>APIKEY Value </option>            </select><br>
        
        Destination Number: * <br>
        <input class="form-control" type="text" id="test_number" required><br>

        <br><br>

        Text: * <br>
        <textarea class="form-control" id="test_text" required rows=5></textarea><br>
            </div>

 

 

Now how do I insert multiple numbers on the Destination number...when i give commas, it gives errors but the message goes with single number

 

Need hlp

Share this post


Link to post
Share on other sites

I see confusing things here.  LIke no form tag for your inputs, no <select> tag for your <option>.

So - what is this "Destination number" you are referencing?  I see you have assigned a text string to the $destination variable, but I see no other reference to a "destination".

Share this post


Link to post
Share on other sites

What API are you using? Have you looked at the documentation? If the API allows for more than one number, I'm guessing you would need to group the numbers in some way, like with an array.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.