very simple source code viewer script

Started on the old forum in September 2010 · view the original in the archive · old links redirect here

7 replies · 8,613 views · started 16 years ago · 1 min read

7 participants
GumSlone Administrator Principal · 1,690 posts #1
<?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

External image (may be gone)

RJNzone Junior · 10 posts #2

where will i put that? add code?

akela Senior · 305 posts #4

RJNzone wrote: 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

External image (may be gone) Unlimited Web Hosting service. 99.99 $ uptime Guarantee. Free Trail Available for 30 days. Free Script | Null script| Php | Unlimited Web Hosting| Unlimited Space | Unlimited Bandwidth| Unlimited Domain| $3/m Unlimited Space | Unlimited Bandwidth|5 Domain| $2/m 10 GB Space | 100 GB Bandwidth| 1 Domain| $1/m FFMPEG| FREE SCRIPT | FREE SITE BUILDER |LIVE SUPPORT [Timewebhosting.com On Web Hosting| Unlimited Web Hosting](http://www…

RJNzone Junior · 10 posts #5

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

mkjmkj Junior · 42 posts #8

Some update To the script warping the HTML 🙂

<?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

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

demo at - HTML source viewer 😛

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close