473,799 Members | 3,218 Online
Bytes | Software Development & Data Engineering Community
+ 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($filen ame));

echo $contents;

?>

Aug 30 '05 #1
5 1259
On 30 Aug 2005 12:53:06 -0700, pe**********@ya hoo.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($filen ame));


What's in $filename?

--
Andy Hassall :: an**@andyh.co.u k :: 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.altav ista.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**********@ya hoo.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.altav ista.com/";
$handle = fopen($filename , "r");
$contents = fread($handle, 100000000);


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

--
Andy Hassall :: an**@andyh.co.u k :: 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_conten ts(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
7985
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 example of a DocumentComplete routine that will: - display a list of all elements (tags?) on the page - number of forms on the page - ID, name, type and value for each field on the form
11
3588
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 database randomly....otherwise it's always runs into a session time out.... **Also when i save new account info (You'll notice that i've been asked to put a save button near each record...so, it's not one global save it's by record), i'd like to be...
4
6661
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 HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"> ' create and open the connection to the Excel file Set conn = Server.CreateObject("ADODB.Connection") conn.Open "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" &...
119
4640
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, http://www.alistapart.com/articles/betterliving/ I read on http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/netfxcompat.asp It said they changed stuff like this
1
3245
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 information . Which may some not be present. I have tried the following If ds.Tables("msc_data").Rows(0)(1) <> Nothing Then lblIMEI.Text = ds.Tables("msc_data").Rows(0)(1) End If
2
9209
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 now. On presenting it to the users they pointed out that their users could change the values in the checkboxes and then print them out, ultimately documenting false information.
9
3187
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... So the behavour is similar to a tab control. The user is expected to fill out required data on each of the panels before pressing a submit button which is visible from all panels. Problem I have is validating the data entered by the user. I...
9
4275
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 read the value of redirect from the error statusCode 404. My web.config looks like this: <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx"> <error statusCode="404" redirect="Error404.aspx" /> </customErrors>
3
1963
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 prompt when I boot from a CD to dfetermine if a screen is 800X600, XGA, SXGA+, UXGA, etc. I can compile C++ under visual studio 6. Thanks
10
2964
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 display a small photo and other information to scroll in a box on the web page. The marquee's info is a table with data that I now insert manually. I would like to be able to insert the data into it from a mysql database. The marquee works by...
0
9688
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
9546
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
10490
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
10260
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...
1
7570
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
6809
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
5467
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
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.