free
This is our archive, please go to the main forum page for the latest discussions and news about free web hosting.


HTML to ASCII converter

iBrightDev
December 1st, 2007, 01:54
make a file names str2ascii.php and paste the following code in it.

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


<?php

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

return implode( null, $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>





  
  News · Search free hosts · Free file hosting · Free image hosting · Reviews · Forums · Related Links · Advertising Info · Contact Us


Copyright © 1996-2008 Per Olof Sandholm. All rights reserved. Privacy Statement

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum