473,598 Members | 3,244 Online
Bytes | Software Development & Data Engineering Community
+ 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 14873

"johnathan" <de**@jdcommerc e.com> wrote in message news:18******** *************** ***@posting.goo gle.com...
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($fileHan dle, $line);

//Close File
close($fileHand le);
?>
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***@glassgian t.com
http://www.glassgiant.com
Jul 17 '05 #3
Shawn Wilson <sh***@glassgia nt.com> wrote in message news:<3F******* *******@glassgi ant.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**@jdcommerc e.com> wrote in message news:18******** *************** ***@posting.goo gle.com...
Shawn Wilson <sh***@glassgia nt.com> wrote in message news:<3F******* *******@glassgi ant.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**@chronofis h.com> wrote in message news:<snEBb.523 08$dO2.15782@la keread03>...
"johnathan" <de**@jdcommerc e.com> wrote in message news:18******** *************** ***@posting.goo gle.com...
Shawn Wilson <sh***@glassgia nt.com> wrote in message news:<3F******* *******@glassgi ant.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**@jdcommerc e.com> wrote in message news:18******** *************** **@posting.goog le.com...

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
1747
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 correct, but giving error says " file is accessed by other process cannot access" I have some logic inbetween and write the info using response.write in to html format Ex: Response.Write("<td>" & "client_no" & "</td>"). I am getting the error at :...
14
595
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 Thanks in advance Hugh
5
2010
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 dependent functions. So need to define and include different libraries and functions for both OS-types. How can I do this using e.g. compiler #define's that all compilers understand? And can I do this also inside of a function?
4
2944
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, like DOS, uses memory-mapped display, two bytes per character (one char byte and one attribute byte). We can get the screen offset allright, and I've written a javascript which does the math to convert the offset into row/col (i.e. left, top)...
6
9216
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 privileage by file manager and IIS manager. However, one PC is okay and another PC is not. Any help on this will be greatly appreciated. Regards, --sambuela
17
3440
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 here is my situation. I would like to create a program that grabs the source of a displayed webpage, sends it off to another program, then receive the slightly modified source back from that other program, and then reposts the slightly modified...
0
3550
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 OleDbParameterCollection" whenI try to write a new record. Delete and Modify work fine its just the add record function causes the error.
0
789
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 by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
3
14046
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 by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
0
7992
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7904
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8398
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8400
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8267
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3940
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2414
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 we have to send another system
1
1505
muto222
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.