473,378 Members | 1,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

View the source of a web page using a script?

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
2 2074
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Droolboy | last post by:
I'm trying to build a fairly small (max. 10 different pages) site using php, and it's becoming obvious that I need some kind of model view separation. Having done a few searches, I've come...
5
by: Pete Wason | last post by:
Hiall! I have a demo viewer page for javascript stuff that has three buttons "DEMO" "HTML" and "JSCR", and an IFRAME called 'viewer'. Initially, the IFRAME gets loaded with the actual demo...
5
by: Poster | last post by:
I have a script, its outputs are in HTML. It displays perferctly in a browser, however when I view source, it gives me the JS scripts, but I want to view the HTML output. Is there a way I can view...
6
by: shr | last post by:
Is there any way by which I can display the source of a html page using the 'view:source' command, in an iframe?? I tried using this viewer.location = "view-source:" + viewer.location.href; where...
14
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as...
2
by: NG WEI CHUNG | last post by:
Hi, Some of my clients site is unable to view the ASP .NET page due to the proxy server and firewall or perhaps IE setting etc, I m not sure what is the actual cause of the problem, it display...
24
by: Roman | last post by:
Hello to everybody, I have some question concerning blocking view source from main menu of IE or MF. I am able to block right click with <body oncontextmenu="return false"> but still missing from...
6
by: jwwishart | last post by:
For some reason I'll view an aspx page and... 1. Scripts that I add (using the RegisterStartupScript method of the Page object) dont show up in the source(IE->View Source)even thought I know...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.