Closed Thread
Results 1 to 1 of 1

Thread: HTML to ASCII converter

  1. #1
    Jay Street iBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond reputeiBrightDev has a reputation beyond repute iBrightDev's Avatar
    Join Date
    Oct 2005
    Location
    Not sure, need a GPS.
    Posts
    7,126

    HTML to ASCII converter

    make a file names str2ascii.php and paste the following code in it.

    demo:
    http://www.mct-hosting.com/str2ascii.php

    PHP Code:
    <?php

    function str2ascii($string) {
        
    $ascii = array( );
        for( 
    $i 0$i strlen$string ); $i++ ) $ascii$i ] = sprintf"&#%d;"ord$string{$i} ) );

        return 
    implodenull$ascii );
    }

    if(
    $_POST){
        
    $find = array('&amp;#32;');
        
    $replace = array(' ');
        
    $str htmlentities(str2ascii($_POST['plainTXT']), ENT_QUOTES);
        
    $fixedSTR str_replace($find$replace$str);
        
    $str $fixedSTR;

    }

    ?> 

    <form action="str2ascii.php" method="post">
    Plain Text Here:<br>
    <textarea name="plainTXT" cols="50" rows="8"><?=$_POST['plainTXT'];?></textarea>
    <br><br>
    Converted Ascii Text Here:<br>
    <textarea name="asciiTXT" cols="50" rows="8" wrap="hard"><?=$str;?></textarea>
    <br><br>
    <input name="Submit" type="submit" value="Convert to Ascii">
    </form>
    Last edited by iBrightDev; December 1st, 2007 at 12:25.
    Full-service digital agency based in Scottsdale, Arizona - iBright Development

Closed Thread

Tags for this Thread

Bookmarks

Posting Permissions

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