encode - How to uncode all symbole in the php code -
i want encode symbole à é è ... in php code. example :
à --> %c3%a0 é --> %c3%a9 è --> %c3%a8 an example in code :
$name = 'teàst'; $result = file_get_contents('http://example.com/name/' . $name . ) the url need : http://example.com/name/te%c3%a0st
need add code please ?
you should using urlencode function translate characters characters can use in url.
$name = utf8_encode('teàst'); $result = file_get_contents('http://example.com/name/' . urlencode($name)); update mentioned encoding ascii , not uft-8 need convert encoding ascii uft-8 first calling utf8_encode, i've updated example show this.
Comments
Post a Comment