Page 1 of 1
get html
Posted: Wed Jul 06, 2005 7:29 pm
by SidewinderX
i was wondering if there was a function to get the html of a site (view the html source). I did it a wile ago...i thought i did it with file_get_contents but that dosnt seem to be working..it just displays the entire site not the source...does anyone have any idea of the function im looking for?
Thanks
Posted: Wed Jul 06, 2005 7:53 pm
by Burrito
display the output on an html page are you? If so, then display the page normally it should (being parsed by the browser it is).
look at
htmlentities() to convert to a viewable "source" you should.
Posted: Thu Jul 07, 2005 10:29 am
by bokehman
Hi! Is this what you are looking for?
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>InsideView</title>
</head>
<body>
<?php
$file = $_POST['file'];
$form = "<form action=\"\" method=\"post\">\n" .
"Enter a URL\n" .
"<input type=\"text\" name=\"file\" value=\"http://\" tabindex=\"1\" />\n" .
"<input id=\"submit\" type=\"submit\" value=\"Look at the source code\" tabindex=\"1\" />\n\n";
if (empty ($file)) {
print $form;
}else{
$ok = @($file = file_get_contents ($file));
if (!$ok) {
echo "<p>It appears that URL isn't valid! Please try again<br />$form</p>";
} else {
print ('<pre>' . htmlspecialchars ($file) . '</pre>');
}
}
?>
</body>
</html>[/php:1:ada3d3etrict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>InsideView</title>
</head>
<body>
<?php
$file = $_POST['file'];
$form = "<form action=\"\" method=\"post\">\n" .
"Enter a URL\n" .
"<input type=\"text\" name=\"file\" value=\"http://\" tabindex=\"1\" />\n" .
"<input id=\"submit\" type=\"submit\" value=\"Look at the source code\" tabindex=\"1\" />\n\n";
if (empty ($file)) {
print $form;
}else{
$ok = @($file = file_get_contents ($file));
if (!$ok) {
echo "<p>It appears that URL isn't valid! Please try again<br />$form</p>";
} else {
print ('<pre>' . htmlspecialchars ($file) . '</pre>');
}
}
?>
</body>
</html>[/php:1;quote; method=\"post\">\n" .
"Enter a URL\n"e; .
"e;<input type=\"e;text\"e; name=\"e;file\"e; value=\"e;http://\"e; tabindex=\"e;1\"e; />\n" .
"<input id=\"submit\" type=\"submit\" value=\"Look at the source code\" tabmp;amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>InsideView</title>
</head>
<body>
<?php
$file = $_POSTї'file'];
$form = "e;<form action=\"e;\"e; method=\"e;post\"e;>\n"e; .
"e;Enter a URL\n"e; .
"e;<input type=\"e;text\"e; name=\"e;file\"e; value=\"e;http://\"e; tabindex=\"e;1\"e; />\n"e; .
"e;<input id=\"e;submit\"e; type=\"e;submit\"e; value=\"e;Look at the source code\"e; tabindex=\"e;1\"e; />\n\n"e;;
if (empty ($file)) {
pmp;quote;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"e;>
<html lang="e;en"e; xmlns="e;http://www.w3.org/1999/xhtml"e;>
<head>
<meta http-equiv="e;content-type"e; content="e;text/html; charset=iso-8859-1"e; />
<title>InsideView</title>
</head>
<body>
<?php
$file = $_POSTї'file'];
$form = "e;<form action=\"e;\"e; method=\"e;post\"e;>\n"e; .
"e;Enter a URL\n"e; .
"e;<input type=\"e;text\"e; name=\"e;file\"e; value=\"e;http://\"e; tabindex=\"e;1\"e; />\n"e; .
"e;<input id=\"e;submit\"e; type=\"e;submit\"e; value=\"e;Look at the source code\"e; tabindex=\"e;1\"e; />\n\n"e;;
if (empty ($file)) {
print $form;
}else{
$ok = @($file = file_get_contents ($file));
if (!$ok) {
echo "e;<p>It appears that URL isn't valid! Please try again<br />$form</p>"e;;
} else {
print ('<pre>' . htmlspecialc<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>InsideView</title>
</head>
<body>
<?php
$file = $_POST['file'];
$form = "<form action=\"\" method=\"post\">\n" .
"Enter a URL\n" .
"<input type=\"text\" name=\"file\" value=\"http://\" tabindex=\"1\" />\n" .
"<input id=\"submit\" type=\"submit\" value=\"Look at the source code\" tabindex=\"1\" />\n\n";
if (empty ($file)) {
print $form;
}else{
$ok = @($file = file_get_contents ($file));
if (!$ok) {
echo "<p>It appears that URL isn't valid! Please try again<br />$form</p>";
} else {
print ('<pre>' . htmlspecialchars ($file) . '</pre>');
}
}
?>
</body>
</html>