View Full Version : Encode php line code url, please help

07-11-2012, 11:17 PM
Need a little direction with this.

I am trying to encode this line so it write the URL dislayed as somewhat encode form souorce viewer.

The URL:

I would like it to appear as something gebirsh or encoded:



$js_songs_url[] = "songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i])."';" ;

I have tried these methods none work

$js_songs_url[] = mb_convert_encoding("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;

$js_songs_url[] = rawurldecode("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;

$js_songs_url[] = html_entity_decode("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;

$js_songs_url[] = preg_replace("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;

NONE worked for me...

07-11-2012, 11:27 PM
You need to use an encoding function such as rawurlencode (note encode, not decode).
It only has value if you are passing information by querystring. The browsers are responsible for interpreting the provided dns, and if you give it a link that's encoded it will not know what to do with it.

Now, given the entire change you have above, you'll need to write something custom to do that.

07-12-2012, 02:35 AM
You want to encode it then have some code decode it and play it?

07-12-2012, 02:55 AM
If you want to display it encoded and then play decoded, you can use base64_encode also