Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2009, 06:30 AM
Authorized User
 
Join Date: Apr 2008
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Default Reading from another website?

On my website, I want to include selected content from another website. The other website is well structured, so I can pinpoint accurately, the selection(s) of HTML code that I will want to use.

Is this possible with PHP?

Some basic example would be greatly appreciated. Doesn't need to be massively in depth, beyond capturing the URL content, as I can sort the string manipulation from there.
__________________
Regards,

Sean
 
Old March 6th, 2009, 12:05 AM
Authorized User
 
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

Fist of all ..
It is not ethical...

But it is possible to get the whole content of other site

PHP Code:
$url         'http://p2p.wrox.com/beginning-php/73096-reading-another-website.html';

$handle = @fopen($url"r");
if (
$handle) {
    
$buffer "";
    while (!
feof($handle)) {
        
$buffer.= fgets($handle4096);
    
    }
    
fclose($handle);
}
echo 
$buffer
try this code

Regards
Anees
 
Old March 6th, 2009, 03:27 AM
Authorized User
 
Join Date: Apr 2008
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you Anees, will give that a go.

Whether or not it's ethical, I would say depends on what you use, how you use it and what credit you give to the originator. For my purpose, I am using quite precise pieces of data which will be clearly marked with where it comes from and could (if my site works as well as I hope) generate traffic and business for the originator, so can't see anyone grumbling with that.
__________________
Regards,

Sean





Similar Threads
Thread Thread Starter Forum Replies Last Post
all about website benny HTML Code Clinic 2 February 11th, 2008 04:49 AM
Dynamic website to Static website Aboal3ood ASP.NET 1.x and 2.0 Application Design 4 December 7th, 2006 11:46 AM
WebSite Programming xiaoxinge2008 ADO.NET 3 November 16th, 2004 03:59 AM
Reading html file from website vijaya_murali Java GUI 1 July 26th, 2004 09:33 AM
Multilingual website happygv Classic ASP Basics 5 April 12th, 2004 03:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.