Hello guys i am trying to run an API request which uses URL based authentication. But whenever the message has some spaces in between the message text i receive the error
failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in C:\wamp64\www\testscripts\wialon.php on line 21
When i take the same url string(with the message having spaces in between) and run it on a browser the message sending is successful bellow is my code
<?php
$sendname=$_GET['name'];
$sendage=$_GET['age'];
$passdat=$_GET['password'];
$url = 'https://api.smsleopard.com/v1/sms/send?username=O6QDPDmFBDu6BYBTTX3q&password=.$passdat&message='.$sendage.'&destination=254700160125&source=TWIGA';
$contents = file_get_contents($url);
//If $contents is not a boolean FALSE value.
if($contents !== false){
//Print out the contents.
echo $contents;
}
exit();
}