Encode
Encode through PHP
?php $message = "test & new"; $encodedMessage = urlencode($message); $api = "https://control.msg91.com/sendhttp.php?authkey=4eSgNljVp251bc26856&mobiles=9999999999&message=" . $encodedMessage . "&sender=123456&route=default";?
Encode through Java
import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class EncodeUrl { public static void main(String args[]) { try { String url = "test & new"; String encodedUrl = URLEncoder.encode(url, "UTF-8"); System.out.println("Encoded URL " + encodedUrl); } catch (UnsupportedEncodingException e) { System.err.println(e); } } }