Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Location
    Bay Area -USA
    Posts
    1,738

    Customized URLencode()

    I am trying to think of a way to rewrite a URL to work with how I want it.

    For example I'm trying to have the spaces in the URL coded as - rather than +

    PHP Code:
    <?php

    function encode_url($url){

    $newUrl urlencode($url);
    $urlnew str_replace('+''-'$newUrl);
    return 
    $urlnew;
    }

    print(
    encode_url("this is a test"));

    ?>
    This works and prints out 'this-is-a-test'.

    What I also would like to achieve using this is all the %20 and %21 etc codes to be removed. Can someone give me a list of all the common % codes? Thanks.
    <<< Please see Forum Guidelines for signature setup. >>>

  2. #2
    Join Date
    Jun 2004
    Location
    Bay Area -USA
    Posts
    1,738
    http://www.w3schools.com/html/html_ref_urlencode.asp

    opps sorry. I found what i was looking for

    Well maybe someone can use the code above neways.
    <<< Please see Forum Guidelines for signature setup. >>>

Posting Permissions

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