What is URL encoding and how do URL encoding?


What is URL encoding?


URL encoding converts characters into a format that can be sent through the internet. We should use URL encoding for all GET parameters because POST parameters are automatically encoded.



Why URL encoding?


URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format. URLs use some characters for a special use in defining their syntax, when these characters are not used in their special role inside a URL, they need to be encoded. URL encoding is done to encode user input.


Example:

GET- https://control.msg91.com/api/sendhttp.php?authkey=YourAuthKey&mobiles=9999999999&message=test & new&mobile&sender=123456&route=default


In this API, the message content  "test & new" includes the '&' operator, due to which URL encoding is necessary, otherwise it will break your message content and an incomplete message will be sent


Click here to encode