can we take the news from NEWS site and display in our page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

can we take the news from NEWS site and display in our page

Post by dibyendrah »

Hello everybody,
I want to display the news title from any news site and display somewhere in my page. Has anybody done this kind of project ?

Any kind of help will be appreciated.

Thank you,
Dibyendra
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Do you have permission to use the content?

If so; does the news site provide a feed for you to use?

If they do not provide a feed, you could use a regex solution.

Code: Select all

$file = file_get_contents('http://www.somenewssite.com/news.html');

preg_match("#<a href=\"something\"><someuniqueHTML>(*+?)</enduniqueHTML>#",$file,$matches;

echo '<pre>';
print_r($matches);
echo '</pre>';
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

Thank you scottayy so much for your kind reply.
I'll use the news title from news site if they allow me to use. But, I just wanted to make sure if it is possible or not. I'll need this in future fr my application.

Cheers,
Dibyendra
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You might want to read their terms of service, the majority of sites strictly prohibit this kind of behavior.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

Jcart wrote:You might want to read their terms of service, the majority of sites strictly prohibit this kind of behavior.
if we say it is provided by this site,etc cnn.com,would we be able to still use it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That would be up to their terms of service.
Post Reply