very simple source code viewer script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    very simple source code viewer script

    PHP Code:
    <?php
    header
    ('Content-Type: text/html; charset=utf-8');
    echo 
    '<?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Source code viewer</title>
    <meta http-equiv="Pragma" content="no-cache" />
    </head>
    <body>'
    ;
    if(isset(
    $_GET['url']) && substr($_GET['url'],0,7) == 'http://')
    {
    $source file_get_contents($_GET['url']);
    echo 
    '<div>Source code</div><div>'.htmlspecialchars($source).'</div><hr/>';
    }

    echo 
    '<form action="'.$_SERVER['PHP SELF'].'" method="get">
    <div>
    Source URL:
    <input type="text" name="url" value="http://" />
    <input type="submit" value="Show source" />
    </div>
    </form>

    </body>
    </html>'
    ;
    ?>
    Advertise your mobile site for FREE with AdTwirl


    #2
    where will i put that? add code?

    Comment


      #3
      on a php page

      Comment


        #4
        Originally posted by RJNzone View Post
        where will i put that? add code?
        i think you r very new dude.this is very simple code. create php page and past these code. now ready demo Source code viewer
        Last edited by akela; 06.09.10, 11:18.

        Comment


          #5
          i'm very sorry with that.. where can i learn more? i'm new here sir..

          Comment


            #6
            Great work! Thanks for sharing

            Comment


              #7
              Please add color tags

              Comment


                #8
                Some update To the script
                warping the HTML
                PHP Code:
                <?php 
                header
                ('Content-Type: text/html; charset=utf-8'); 
                echo 
                '<?xml version="1.0"?> 
                <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> 
                <html xmlns="http://www.w3.org/1999/xhtml"> 
                <head> 
                <title>Source code viewer</title> 
                <meta http-equiv="Pragma" content="no-cache" /> 
                </head> 
                <body>'

                $source file_get_contents("http://$domain"); 
                $new htmlentities($source); 
                echo 
                '<div>Source code</div><div>'.nl2br($new).'</div><hr/>';  

                echo 
                '<form action="'.$_SERVER['PHP SELF'].'" method="get"> 
                <div> 
                Source URL: 
                <input type="text" name="url" value="http://" /> 
                <input type="submit" value="Show source" /> 
                </div> 
                </form> 

                </body> 
                </html>'

                ?>
                updated these 2Lines

                PHP Code:
                $source file_get_contents("http://$domain"); 
                $new htmlentities($source); 
                echo 
                '<div>Source code</div><div>'.nl2br($new).'</div><hr/>'
                demo at - HTML source viewer
                :p
                Last edited by mkjmkj; 02.09.12, 10:03.

                Comment

                Working...
                X