473,473 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

write html source to a file

How can I use a php script running on my web server to read in the
html source from an arbitrary webpage and then write it to a file on
my web server?
Jul 17 '05 #1
6 14861

"johnathan" <de**@jdcommerce.com> wrote in message news:18**************************@posting.google.c om...
How can I use a php script running on my web server to read in the
html source from an arbitrary webpage and then write it to a file on
my web server?

There are a lot of ways to do this. And I'm sure a PHP purist will post over my suggestions, but try this:

First visit php.net - memorize this as your first stop - it is a great resource
http://www.php.net/manual/en/features.remote-files.php
http://www.php.net/manual/en/function.file.php
http://www.php.net/manual/en/function.fopen.php
http://www.php.net/manual/en/function.fwrite.php
http://www.php.net/manual/en/function.fclose.php

Then you can write the following:

<?
// website to steal from
$fileArray = file(http://www.example.com/coolpage.html);

//Open file for writing
$fileHandle = fopen("/DestinationPath/DestinationFile.html", "w");

//Dump File
foreach ($fileArray as $line) fwrite($fileHandle, $line);

//Close File
close($fileHandle);
?>
Jul 17 '05 #2
johnathan wrote:

How can I use a php script running on my web server to read in the
html source from an arbitrary webpage and then write it to a file on
my web server?


Search php.net for fopen() + related functions.

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3
Shawn Wilson <sh***@glassgiant.com> wrote in message news:<3F**************@glassgiant.com>...
johnathan wrote:

How can I use a php script running on my web server to read in the
html source from an arbitrary webpage and then write it to a file on
my web server?


Search php.net for fopen() + related functions.

Shawn


Thank you for the suggestions. I have been reading about a set of php
functions called curl_init(), curl_exec(), and so on..... i am sure
you guys know about it.
i have successfully used those commands to read raw html source from
websites, but i am now trying to figure out how to use some of the
CURLOPT_* options to view a page that requires userid and password and
is on a secure server. does anybody know how to do this? for example,
how would i use these curl functions in order to view my online bank
account summary?
Jul 17 '05 #4

"johnathan" <de**@jdcommerce.com> wrote in message news:18**************************@posting.google.c om...
Shawn Wilson <sh***@glassgiant.com> wrote in message news:<3F**************@glassgiant.com>...
johnathan wrote:

How can I use a php script running on my web server to read in the
html source from an arbitrary webpage and then write it to a file on
my web server?


Search php.net for fopen() + related functions.

Shawn


Thank you for the suggestions. I have been reading about a set of php
functions called curl_init(), curl_exec(), and so on..... i am sure
you guys know about it.
i have successfully used those commands to read raw html source from
websites, but i am now trying to figure out how to use some of the
CURLOPT_* options to view a page that requires userid and password and
is on a secure server. does anybody know how to do this? for example,
how would i use these curl functions in order to view my online bank
account summary?


Sounds dangerous and/or illegal. Here's the rope: http://www.php.net/manual/en/ref.curl.php

-CF
Jul 17 '05 #5
"ChronoFish" <de**@chronofish.com> wrote in message news:<snEBb.52308$dO2.15782@lakeread03>...
"johnathan" <de**@jdcommerce.com> wrote in message news:18**************************@posting.google.c om...
Shawn Wilson <sh***@glassgiant.com> wrote in message news:<3F**************@glassgiant.com>...
johnathan wrote:
>
> How can I use a php script running on my web server to read in the
> html source from an arbitrary webpage and then write it to a file on
> my web server?

Search php.net for fopen() + related functions.

Shawn


Thank you for the suggestions. I have been reading about a set of php
functions called curl_init(), curl_exec(), and so on..... i am sure
you guys know about it.
i have successfully used those commands to read raw html source from
websites, but i am now trying to figure out how to use some of the
CURLOPT_* options to view a page that requires userid and password and
is on a secure server. does anybody know how to do this? for example,
how would i use these curl functions in order to view my online bank
account summary?


Sounds dangerous and/or illegal. Here's the rope: http://www.php.net/manual/en/ref.curl.php

-CF

whoa.... well, nevermind if it's illegal. i thought it would be okay
if i am using it to view my own personal information.... thanks
anyway.
Jul 17 '05 #6

"johnathan" <de**@jdcommerce.com> wrote in message news:18*************************@posting.google.co m...

Sounds dangerous and/or illegal. Here's the rope: http://www.php.net/manual/en/ref.curl.php

-CF

whoa.... well, nevermind if it's illegal. i thought it would be okay
if i am using it to view my own personal information.... thanks
anyway.


If you're viewing your own personal information then the legality of it depends on the license agreement you agreed to with your
provider (bank or whatever).

The danger doesn't go away however. You are taking your personal information from an encrypted source to a text source. If the
machine that is doing the "getting" is the same machine that you're viewing from (i.e. localhost) then there probably isn't anything
to worry about.

However if the machine that is doing the "getting" is hosted, then the link from it to your browser can be packet sniffed and it's
also possible that some of the information could end up in the server's logs. Additionally (as proven by RIAA/Verizon) your ISP may
have logged some of the data as well.

-CF
Jul 17 '05 #7

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

Similar topics

0
by: hari krishna | last post by:
hi all, My requirement is to generate xl reports throu Asp.Net without installing xl on web server computer. i am using Response object and wrtifile method as below. i dont know whether it is...
14
by: Hugh Welford | last post by:
Hi - trying to display a memo field using response.write but it truncates it. Is there a size issue with response.write? If so how do I get round it and to be able to display the whole memo field ...
5
by: Henri Schomäcker | last post by:
Hi folks, I have a quite big class, which I want to use on UNIX-like systems and on win32. Until now, everything is absolutely portable. But now I need to read a directory and use the os...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
6
by: sambuela | last post by:
How can I write message to the file located in the wwwroot directory? It seems that IIS protect these files. Let make me cannot do the I/O writing sucessfully. I try to open file's write...
17
by: chris.schwalm | last post by:
I would like to first state that I have searched through the archives and found a lot of related material, but am still new enough to javascript that I can't fit all the pieces together yet. So...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.