On 29 Jun 2006, at 08:41 , Ronald J Kimball wrote:
On Thu, Jun 29, 2006 at 12:03:43AM -0600, Google Kreme wrote:

<?php

$URL = "%74%6c%61%67%75%73%67%68%38%32.%63%61%66%65%32%34.%63%6f%6d";
$myString = explode('%', $URL);

foreach ($myString as $value) {
    if (substr($value, -1) == '.') {
        echo chr(hexdec($value)).'.';
    } else {
        echo chr(hexdec($value));
    }
}
?>

fugly, but it yields "tlagusgh82.cafe24.com" and is understandable to
someone who doesn't speak php.

Won't that break if the URL contains non-encoded characters other than
period?

Yep. Is that a problem? I've never seen them mix hex and ascii in the same URL.

Besides, this was merely a demonstration. I also didn't show how to strip out the http:// or the trailing path location.


--
Q: Does anyone know how many LOCs were in the Space Shuttle's codebase?
A: 45.  It was written in perl
  (paraphrased Slashdot discussion)



--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to