I am sending sms to cellphones using PHP and an API key provided by my sms service provider.
The sms that I send reaches the target cellphone perfectly but the problem is when I have a "+"
sign in my message the "+"
do not appear in the cellphone. This is probably happening because the "+"
sign is basically used for indicating a space.
When I run the api my code looks like following:
$msg="A+";
$x= file_get_contents("http://someurl...&msg=$msg");
Could you please tell me what to do to make the "+"
appear in cellphones.
Thanks
You'll need to look into using the function urlencode.
$x = file_get_contents("http://someurl...&msg=" . urlencode($msg));
Try to use urlencode
$msg = urlencode("A+");
As php manual says:
This function is convenient when encoding a string to be used in a query part of a URL, as a convenient way to pass variables to the next page.
Use urlencode...
$msg="A+";
$msg = urlencode($msg);
$x= file_get_contents("http://someurl...&msg=$msg");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With