473,909 Members | 4,177 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 14883

"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
1772
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
2030
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
2964
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
9318
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
3476
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
3597
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
14076
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
11346
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...
1
11046
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10538
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...
1
8097
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7248
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
6138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4774
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
2
4336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3357
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.