Sample code for 30+ languages & platforms
PHP ActiveX

URL Encoding and Decoding

Demonstrates URL encoding/decoding using the HTTP convenience methods.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$http = new COM("Chilkat.Http");

$s = 'Hello World! 100% sure.';

$encoded = $http->urlEncode($s);
print 'URL encoded: ' . $encoded . "\n";

// Space → %20
// ! → %21
// % → %25

$decoded = $http->urlDecode($encoded);
print 'URL decoded: ' . $decoded . "\n";

// Output:

// URL encoded: Hello%20World%21%20100%25%20sure.
// URL decoded: Hello World! 100% sure.

?>