SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Outputting Unparsed HTML/Code to the Browser

    I'm connecting to an FTP server via an FTP class and retrieving a ColdFusion file which I need to output to the browser in it's raw 'codeview' format. When I echo or print the file contents to the screen, the embedded tags and HTML get treated as actual markup. Embedding in <pre> tags doesn't seem to work.

    Code is as follows:

    PHP Code:
    $ftpAddress 'someserver.com';
    $ftpUser 'user';
    $ftpPassword 'password';

    require_once 
    "class.ftp.php";

    // Create a new FTP client
    $ftp = new FTP$ftpAddress$ftpUser$ftpPassword );

    // Get a file:
    $fileContents $ftp->getFile'myfile.cfm''/path/to/file );
    echo "<pre>";
    echo $fileContents;
    echo "</pre>"; 
    I know I'm missing something obvious
    Last edited by ghuytro; Oct 3, 2004 at 13:28. Reason: Changed title to be a more descriptive of the problem at hand.

  2. #2
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,188
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    try echo htmlentities($fileContents);

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TheRedDevil
    try echo htmlentities($fileContents);
    That did the trick!!

    Thanks!!


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
  •