I have a URL with space characters that I want to properly encode when making an API call (in this case replace ' ' with '%20' so the space characters are treated properly.
$url = 'https://www.someapi.com?param=this and that';
Hoever when using the urlencode($url) function I get this obscure representation of the URL
"https%3A%2F%2..."
That I eventually cannot resolve.
Is there a URL-encode function in PHP that just replaces spaces and quotation marks instead of making abrupt changes to the whole string?