1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to remove spaces in urls

Discussion in 'BlackHat Lounge' started by ErjeBoevem, Jun 2, 2010.

  1. ErjeBoevem

    ErjeBoevem BANNED BANNED Premium Member

    Joined:
    Sep 18, 2009
    Messages:
    375
    Likes Received:
    160
    Here is the problem that gives me a major headace, it should be simple but for me it seems impossible.

    Problem:
    I have a couple of tousand urls in this format:
    http://112db.com/forum/ index.php?action=register

    I want the URLs in this format Just removing the spaces):
    http://112db.com/forum/index.php?action=register


    Ofcourse I can do it manually but it would take days for my URLs.

    So I am asking if you guys know a easy way to fix this?

    -KillerUMF
     
  2. lord

    lord Junior Member

    Joined:
    Jan 21, 2009
    Messages:
    176
    Likes Received:
    251
    dude, load the urls in word/wordpad/ even freaking notepad or whatever text editor you have

    hit that "replace" option up and just replace "forum/ index.php" with "forum/index.php"


    easy, right ?
     
  3. aftershock2020

    aftershock2020 Senior Member

    Joined:
    Oct 19, 2007
    Messages:
    981
    Likes Received:
    477
    Just use the ' trim () ' function

    PHP:
    <?php 

    // The original text string with whitespace at the end

     
    $textString "This is some text with a space after it ";  

    // Remove the whitespace

     
    $trimmedTextString trim($textString); 
     
    // Display the new text string 

    echo $trimmedTextString;  

    ?>


    All you have to do is drop your list into a database, change the variables as the resulting domain and have it echo the entire list. Then, simply copy that list. Will take about 10 minutes to setup and complete.
     
    Last edited: Jun 2, 2010