Any one help me on SMS API integration with sign-up page

I have been battling with my sign-up code,
I got an API from an sms company, I want users to get sms after sign-up.
But which i found so challenging. Kindly help me out.

What’s the error message or response you are getting?

1 Like

Good moring, Thanks for your reply.
Here is my code that submit to DATABASE

    $sql="INSERT INTO ads (ads_title, ads_content, poster, status, date, song, songsize, ads_pic)

VALUES
(’$title’,’$body’,’$poster’,’$category’,’".date(“Y-m-d H:i:s”)."’,’$song’,’$songsize’,’$location’)";

$test =
if (!mysql_query($sql))
{
die('Error: ’ . mysql_error());
}
header(“location: myfunctions.php”);

exit();

        }}

?>

THIS IS THE “myfunctions.php” PAGE with the SMS API

<?php header("location: https://smartsmssolutions.com/api/?message=Bad&to=08066291798&sender=SGZ Ent 3&type=0&routing=3&token=jQeNHcccn7XiK4RjyXIM0MbemmxNxYYokP2LBIEO4QrweedpThLdfxQGcYI1EpmZ1pLoLAGkNdTqC78y3CiRVOaBa5z64EY3a"); //header("location: home.php"); ?>

My major problem is that, the SMS is sent but the page refuse to redriect to ‘‘home.php’’

Hi, from what you have in the myfunction.php file you’re re redirecting to the SMS provider rather than your home page. You re supposed to send a get request to the SMS API and then redirect to your homepage

hoo sowi, i comment on the the second header. before i copy the code.

this is what i actually have there
THIS IS THE “myfunctions.php” PAGE with the SMS API

<?php header("location: https://smartsmssolutions.com/api/?message=Bad&to=08066291798&sender=SGZ Ent 3&type=0&routing=3&token=jQeNHcccn7XiK4RjyXIM0MbemmxNxYYokP2LBIEO4QrweedpThLdfxQGcYI1EpmZ1pLoLAGkNdTqC78y3CiRVOaBa5z64EY3a"); header("location: home.php"); ?>

My major problem is that, the SMS is sent but the page refuse to redriect to ‘‘home.php’’

so i think, after redirection to the SMS API, Its will also redirect back to my Home.php. but it only redirect to the SMS API then stop there.
That has been my challenge with it

I understand, what i’m saying is that you call the SMS API separately(i.e don’t use the header function for that) and then redirect to wherever u want on success . U can check out the guzzle php library, if you are finding it hard, It makes consuming APIs easy in PHP.

I will advise you to use twilo instead https://www.supremo.tv/insights/basic-php-integration-twilio-sms/