Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Encode php line code url, please help

    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:
    http://sitepoint.com/images/user/media/song.mp3

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

    http://%%5dfsitepoint%%%/@#$%%./CD%20%%%%&*


    Line

    Code:
    $js_songs_url[] = "songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i])."';" ;
    I have tried these methods none work



    Code:
    $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...

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    You want to encode it then have some code decode it and play it?

  • #4
    New Coder
    Join Date
    May 2012
    Posts
    17
    Thanks
    0
    Thanked 3 Times in 3 Posts
    If you want to display it encoded and then play decoded, you can use base64_encode also


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •