Convert hex encoded URL PDF Print E-mail
Written by Carl Friis-Hansen   
Wednesday, 17 February 2010 01:36

 

Hi there.  Sometimes website owner wants to hide the URL to a certain video or sound file.  One trick try use is to write the URL as a whole line of ASCII numbers in HEX notation like \u0068\u0074\u0074\u0070\u003a\u002f \u002f instead of http://

Both strings do the same thing, but in case you want to download the video or whatever with wget, vlc or another application, then a convertion might be needed.  This is where this tiny PHP command line program comes into play.

 

The syntax:

converturl

converturl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/php
<?php
 
 
 
 $surl = "\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0077\u0077\u0077";
 
 // Will result in: "http://www"
 
 $change = false;
 
 if( $argc == 2 )
 {
   $surl = $argv[1];
 }
 
 for( $x=0; $x<256; $x++ )
 {
   $r = chr( $x );
   $s = "\u00".bin2hex( chr( $x ) );
   $surl = str_replace  ( $s, $r, $surl );
   $s = "\u00".strtoupper( bin2hex( chr( $x ) ) );
   $surl = str_replace  ( $s, $r, $surl );
 };
 
 print "\"".$surl."\"\n";
 
 
 
?>

Last Updated on Wednesday, 17 February 2010 02:04
 

Add comment

To be able to vote and have easier access to write comments, etc., go to Login and register yourself.
Your user name and email will never leave this website.


Security code
Refresh