Reputation: 151
This is how I'm going to use an API to send SMS messages out to my customers if the item has been completed ahead of schedule.
when I write a message "Test Test.com - We test just text message"
so that it only pops up and says "test" and it does not print the rest of the text.
$callApi = file_get_contents("http://www.smsit.dk/api/sendSms.php?apiKey=xxxxxxxxx&senderId=xxxxxxx&mobile=45$tlf&message=".$_POST["smsTekst"]);
the error is that it does not write the whole text, as I would imagine that it would.
Upvotes: 2
Views: 270
Reputation: 137537
You probably need to urlencode
your data before putting it in the query string.
$txt = $_POST["smsTekst"];
$txt = urlencode($txt);
$url = "http://www.smsit.dk/api/sendSms.php?apiKey=xxxxxxxxx&senderId=xxxxxxx&mobile=45$tlf&message=" . $txt
$callApi = file_get_contents($url);
Also, you certainly want to validate that POST data before you use it.
Upvotes: 2