By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,744 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,744 IT Pros & Developers. It's quick & easy.

View the source of a web page using a script?

P: n/a
This is probably some really basic operation, but how do I view the source
of a web page using a php script.

For example I want to have a variable, say

$url = "www.google.com";

Then I want to echo its source code, so that I have a page showing:

<html>
<head><title>Whatever</title></head>
<body>
..
..
</body>
</html>

Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Matt Traxinger wrote:
This is probably some really basic operation, but how do I view the source
of a web page using a php script.

For example I want to have a variable, say
<?php
$url = "www.google.com";
$url = 'http://' . $url . '/';
/*
Then I want to echo its source code, so that I have a page showing:

<html>
<head><title>Whatever</title></head>
<body>


*/

echo htmlentities(file_get_contents($url));
?>
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2

P: n/a
"Pedro Graca" <he****@hotpop.com> wrote in message
news:c4*************@ID-203069.news.uni-berlin.de...

echo htmlentities(file_get_contents($url));


or show_source($url);
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.