You're not going to find a PHP function that doesn't encode the single quote. Reason being is PHP adhere's more strictly to RFC 3986 which includes the single quote.
RFC 3986
reserves special characters such as !, ', (, ), and *
.
URIs include components and subcomponents that are delimited by
characters in the "reserved" set. These characters are called
"reserved" because they may (or may not) be defined as delimiters by
the generic syntax, by each scheme-specific syntax, or by the
implementation-specific syntax of a URI's dereferencing algorithm.
If data for a URI component would conflict with a reserved
character's purpose as a delimiter, then the conflicting data must be
percent-encoded before the URI is formed.
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
If you want to match php and have the single quote encoded in js you can use a function like this.
function fixedEncodeURIComponent (str) {
return encodeURIComponent(str).replace(/[!'()*]/g, escape);
}
Why do you need to not encode it? It should still work with a CURL.