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

Home Posts Topics Members FAQ

read a web page and then display

Hi,

I'd like to read a webpage, the parse it and display a small part of
it. Here is what I've tired. It isn't working. Any suggestions?

Thanks,
Peter

<?php

$handle = fopen("http://www.yahoo.com/", "r");

$contents = fread($handle, filesize($filename));

echo $contents;

?>

Aug 30 '05 #1
5 1239
On 30 Aug 2005 12:53:06 -0700, pe**********@yahoo.com wrote:
I'd like to read a webpage, the parse it and display a small part of
it. Here is what I've tired. It isn't working.
In what way is it not working? What does it do?
$handle = fopen("http://www.yahoo.com/", "r");

$contents = fread($handle, filesize($filename));


What's in $filename?

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Aug 30 '05 #2
Oops. This is getting closer to working

<?php

$filename = "http://babelfish.altavista.com/";

$handle = fopen($filename, "r");

$contents = fread($handle, 100000000);
fclose($handle);

echo $contents;

?>

Aug 30 '05 #3
On 30 Aug 2005 14:11:32 -0700, pe**********@yahoo.com wrote:
Oops. This is getting closer to working
You didn't say how the previous one was "not working". How is this one closer?
What does it do?
$filename = "http://babelfish.altavista.com/";
$handle = fopen($filename, "r");
$contents = fread($handle, 100000000);


Read http://uk2.php.net/fread

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Aug 30 '05 #4
It may be that yahoo and altavista dont like you reading their pages
that way. I wrote a script that would do a site specific search on
google for every website in my favorites. It works once and a while,
but mostly, i get
Warning: file_get_contents(http://www.google.com/search-blahblahblah):
failed to open stream: HTTP request failed!

I havent gotten around to trying:
http://sourceforge.net/projects/snoopy/

--
juglesh

Aug 31 '05 #5
Hi juglesh,

Snoopy was exactly the kind of thing I was after. Thanks!!!

Peter

Aug 31 '05 #6

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

Similar topics

7
by: Noozer | last post by:
I am able to place values on forms that load into my webbrowser control, but I'd like to be able to scan the page for data. I know to use the HTMLDocument object. Basically I'm hoping to find an...
11
by: HolaGoogle | last post by:
hi all, can you please tell me what i should do to avoid session timeout when displaying my database info in my asp form (DisplayUserDatabase.asp)??? ** actualy it does load and display the...
4
by: see_mun_lee | last post by:
I use asp to develop a web page to read an excel file containing Chinese Character then display it in the web page. Unfortunately, I cant display it!!! it will display (?????????). <META...
119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
1
by: chris ogunsalu via .NET 247 | last post by:
(Type your message here) does anyone have some good example of How to read xml into a recordset and display in fields on page. for each node in the xml file i only want to display certain...
2
by: /.. | last post by:
Hi all, I'm working on a report display page that currently uses 5 checkboxlists with a total of 86 items to display values from 5 different tables in an Access database. The page works fine...
9
by: Bill Long | last post by:
I have a control that simply displays a list of links. Following one of the links doesn't post back or redirect to another page, it simply hides the current panel and shows the one you selected......
9
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. Is it programatically possible in VB.NET to read the contents of web.config's <customErrorselement? I looked at using ConfigurationSettings.AppSettings, but that doesn't work. I need to...
3
by: richk | last post by:
I am looking for a way to determine the screen type when I am checking out a laptop that has no HDD installed. I am looking for something I can compile to run under a DOS or windows 98 command...
10
by: CDFTim | last post by:
O.K. that was a long Title... Can you help / show me how I would......... I am going to long windedly try to paint this picture. Backround: I have an html page that has a marquee function in it to...
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,...
0
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...
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,...
1
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...
0
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...
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: 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 ...

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.