473,378 Members | 1,413 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.

Open the source of an html across the net

I got my other question wrong. I wrote a script that opens a file and
filters out email addresses and urls etc.
is there a way to enter a url so that my script will open
the source of the webpage and NOT the web page itself?
Jul 17 '05 #1
7 1450
Kelly wrote:
I got my other question wrong. I wrote a script that opens a file and
filters out email addresses and urls etc.
is there a way to enter a url so that my script will open
the source of the webpage and NOT the web page itself?


All these command-line scripts

$ php -r 'echo file_get_contents("http://www.example.com/"), "\n";'

$ php -r 'echo implode("", file("http://www.example.com/")), "\n";'

$ php -r '$f = fopen("http://www.example.com/", "r");
$t = fread($f, 8000);
fclose($f);
echo $t, "\n";'
return the same result:

<HTML>
<HEAD>
<TITLE>Example Web Page</TITLE>
</HEAD>
<body>
<p>You have reached this web page by typing &quot;example.com&quot;,
&quot;example.net&quot;,
or &quot;example.org&quot; into your web browser.</p>
<p>These domain names are reserved for use in documentation and are
not available
for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
2606</a>, Section 3.</p>
</BODY>
</HTML>
I have

allow_url_fopen = On

in my php.ini
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
Kelly wrote:
I got my other question wrong. I wrote a script that opens a file and
filters out email addresses and urls etc.
is there a way to enter a url so that my script will open
the source of the webpage and NOT the web page itself?


Can you rephrase that?

--
Jock
Jul 17 '05 #3
header("Content-type: text/plain");

if displaying the source is what you're after....

Uzytkownik "Kelly" <fo*@foo.com> napisal w wiadomosci
news:HSL1c.665661$JQ1.372555@pd7tw1no...
I got my other question wrong. I wrote a script that opens a file and
filters out email addresses and urls etc.
is there a way to enter a url so that my script will open
the source of the webpage and NOT the web page itself?

Jul 17 '05 #4
> $ php -r 'echo file_get_contents("http://www.example.com/"), "\n";'

I installed php 4.3.4 and it doesn't appear to support the -r option. Was
this added to a later release?

php -h
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a Run interactively
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
Jul 17 '05 #5
None of those work for me I get this error

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
c:\apache\htdocs\php\spamfilter.php on line 24

"Pedro Graca" <he****@hotpop.com> wrote in message
news:c2*************@ID-203069.news.uni-berlin.de...
Kelly wrote:
I got my other question wrong. I wrote a script that opens a file and
filters out email addresses and urls etc.
is there a way to enter a url so that my script will open
the source of the webpage and NOT the web page itself?
All these command-line scripts

$ php -r 'echo file_get_contents("http://www.example.com/"), "\n";'

$ php -r 'echo implode("", file("http://www.example.com/")), "\n";'

$ php -r '$f = fopen("http://www.example.com/", "r");
$t = fread($f, 8000);
fclose($f);
echo $t, "\n";'
return the same result:

<HTML>
<HEAD>
<TITLE>Example Web Page</TITLE>
</HEAD>
<body>
<p>You have reached this web page by typing &quot;example.com&quot;,
&quot;example.net&quot;,
or &quot;example.org&quot; into your web browser.</p>
<p>These domain names are reserved for use in documentation and are
not available
for registration. See <a

href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC 2606</a>, Section 3.</p>
</BODY>
</HTML>
I have

allow_url_fopen = On

in my php.ini
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--

Jul 17 '05 #6
Christopher Glaeser wrote:
$ php -r 'echo file_get_contents("http://www.example.com/"), "\n";'


I installed php 4.3.4 and it doesn't appear to support the -r option. Was
this added to a later release?


You have to install the command-line version.

php -v
PHP 4.3.3 (cli) (built: Jan 25 2004 23:17:16)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
Or simply make a php file with those commands enclosed in "<?php" and
"?>" and open it in your browser.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #7
[please do not top post]
Kelly top-posted (corrected):
"Pedro Graca" <he****@hotpop.com> wrote in message
news:c2*************@ID-203069.news.uni-berlin.de...
Kelly wrote:
> I got my other question wrong. I wrote a script that opens a file and
> filters out email addresses and urls etc.
> is there a way to enter a url so that my script will open
> the source of the webpage and NOT the web page itself?
All these command-line scripts

$ php -r 'echo file_get_contents("http://www.example.com/"), "\n";' (snip) return the same result:

(HTML snip)
None of those work for me I get this error

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
c:\apache\htdocs\php\spamfilter.php on line 24


What's this spamfilter.php? and the line 24? :)

Try making those command-line scripts into scripts usable by the web
server:

Save this to a .php file and open it in your browser
<?php
$data = file_get_contents('http://www.example.com/');
echo nl2br(htmlentities($data));
?>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

188
by: Ilias Lazaridis | last post by:
I'm a newcomer to python: - E01: The Java Failure - May Python Helps? http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553 - I've download (as suggested) the python...
0
by: Unigroup of New York | last post by:
Content-Type: multipart/mixed; boundary="------------C465DF38DCB38DD2AF7117E0" Lines: 327 Date: Tue, 15 Feb 2005 23:36:38 -0500 NNTP-Posting-Host: 24.46.113.251 X-Complaints-To: abuse@cv.net...
12
by: Christoph Bergmann | last post by:
Hi... We want to write an open source web based TEXT editor and would be happy about any help ;-) Please notice: We do NOT want to write a web based WEB editor, where you can edit a web...
6
by: ultraton | last post by:
While trying to print a report from Access the user receives the following error: Cannot open any more databases. Okay Help Does anyone have any ideas about this behavior? Thank you very...
27
by: Mike | last post by:
Open source programs in general suck pretty bad also. Here are some loose facts regarding why projects like Linux, PHP, MYSQL, and other open source programs suck: - Linux is simply a clone of...
0
by: Richard Jones | last post by:
Call for Papers --------------- Open Source Developers' Conference 2007 - Brisbane, Australia "Success in Development & Business" OSDC is a grass-roots conference providing Open Source...
0
by: Richard Jones | last post by:
The Open Source Developers' Conference is designed by open source developers, for developers and business people. It covers numerous programming languages across a range of operating systems, and...
4
by: wrburgess | last post by:
I am trying to find a PHP control, framework, or application that has a behavior equivalent to the ASP.NET DataGrid or GridView controls. Other terms I've seen are "HTML Table", "Table View", or...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.