Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,156,498 members, 7,830,505 topics. Date: Friday, 17 May 2024 at 12:09 AM

Dynamically Copying The Content Of A Website And Displaying In Another. - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Dynamically Copying The Content Of A Website And Displaying In Another. (2334 Views)

Freehostia.com Cannot Display Content Of File Hosted On The Server. / Displaying Rss Feeds Easily Using Google Ajax Feed Api / How Can U Tell If The Content Of A Website Is Reliable? (2) (3) (4)

(1) (Reply) (Go Down)

Dynamically Copying The Content Of A Website And Displaying In Another. by mavtrevor3: 6:28pm On Jun 02, 2009
I want us to discuss the possible ways of dynamically copying the content of a website and displaying in another, i know using iframes can do such but sometimes it messes up the job, look at nigeriamasterweb for example, the job is messed up and the owner cant even make money from ads cos he cant control the content that displays on his frames, you can manipulate it much, its just like looking through the eye of someone.

So it got me thinking, after some days of intensive research i came up with the idea of using php and curl to do that, but i am not the guru like dhtml in programming, so i will like us to discuss how this could be done without iframes.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by segsalerty(m): 7:03pm On Jun 02, 2009
uhmm 
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by Nobody: 12:47am On Jun 03, 2009
The stuff can be quite complex, but there was something i remember writing focusing on punch website some months ago, i am not sure of where that thread is again on this board, but i still have the source code somewhere.
Anyway, depending on what you wish to do, you can use curl or even file_get_contents
for instance:
<?php
$google=file_get_contents("http://www.google.com/");
echo "$google";
?>
Having said that, you still need to parse through the hyperlinks and handle them anyway you like, that is where some tough programming come into
place. . .
Anyway, great topic, let us see what you have, then i will know what to contribute
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by mavtrevor3: 5:01pm On Jun 03, 2009
Thanks dhtml for your reply, i have been looking out for you though.

<?php
$google=file_get_contents("http://www.google.com/");
echo "$google";
?>


I understand the concept of storing the content as a variable $google and echoing it as "$google". That is a nice concept, but wont be perfect in a situation where you want to copy a certain portion of a page except you specify such in your coding.

I am trying to work out something, though similar to your concept but will look like a "fetch $url " using the curl function.

<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, “http://someothersite.com/index.php”);
curl_exec($curl);
curl_close($curl);
?>
The beauty of this method is that your page will still be crawled by the search engines as usual, whereas solving this problem with frames leaves a lot of doubt as to whether the content is crawled and cached!

Dhtml, do what is your idea about this? I found a script called snoopy, you can see it on http://sourceforge.net/projects/snoopy/ can you check it out for me?
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by Nobody: 2:36am On Jun 04, 2009
while i am checking out your link, i will quickly add that, to copy a portion of the page, you need to look for the html markers or demarkation of the
target area, as in the aspect of the page you wish to copy, then after fetchin the content of the site as a variable, you parse it
with functions like strpos, even using regular expressions to obtain the required aspect - that is the second phase of it, and where real
programming stuff is.

Loaded the snoopy link:

Snoopy is a PHP class that simulates a web browser. It automates the task of retrieving web page content and posting forms, for example

curl or any method of retrieving pages will not automatically give you the aspect you want just like that.
You need to learn how to parse, a skill used by programmers and hackers to filter thru information you want, like parse through all the
links on a web page, or email addresses on the web page,
or like something i wrote awhile ago to lift all the country/states data in <select> tag on a website into database, i first need to be able
to load any page on the site at will, then be able to pick the codes of the select menu i need out of all the others on the site, then read the
information and get all the text and values between all the options, then rewrite mysql queries to enter them into dbase.
Easier said than done, but that is roughly the steps involved.

Learn how to use strpos, and also regular expressions in php, they will be of great help.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by mavtrevor(m): 2:32pm On Jun 04, 2009
It was great hearing from you again and learning from you. i believe there are more to what i thought was the solution to doing that. i always knew parsing the the variables will require a great skill of programming, but i just wanna ask you, can it be done? i believe it can, if you believe same, can we modify the snoopy script to achieve what we want?

How can you help me with this.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by Nobody: 5:51pm On Jun 06, 2009
Parsing is an art, just like painting, i have had to do it many times for different reasons, both good and bad. . .
And one thing i can say is that, it takes practice, and you keep getting better over time.
The unfortunate thing about parsing is that, you can not have a universal code to parse anything u want,
u need to keep making modifications every now and then, and to master it, you need to step into hakin territory.

But for the purpose of this board, i will rather stick to the good side. Maybe you should set up a sample stuff you want
to parse, then i will supply the codes and explanations here, or if you want it on YIM, say so. . .

Though, i usually prefer to post here just so others will learn and also get to criticize my codes too if necessary
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by Nobody: 5:53pm On Jun 06, 2009
No problem, i will modify the snoopy to parse an example you may suggest. But just one for now.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by mavtrevor(m): 1:08pm On Jun 09, 2009
Thanks for your help, i really appreciate it so far, i will be looking forward to seeing an example.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by Nobody: 9:26pm On Jun 12, 2009
I remember that stuff too, and thanks for dropping by. I did not want to mention that your script to the poster,
and i am thankful you did so yourself.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by mavtrevor3: 1:30pm On Jun 13, 2009
Whao, that was a nice trick though, you wont have to come to NL to view the posts anymore, then i have to use such a script to display the content of other sites in another, how can you be of help now.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by Nobody: 3:19pm On Jun 13, 2009
That frees me then. . .
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by mavtrevor3: 7:22pm On Jun 13, 2009
No way dhtml, you are already on it, please dont turn your back on me not now not today. I really need your help man.
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by Nobody: 7:30pm On Jun 13, 2009
Iight, then i am back, but i think you should see what webdezzi has to teach you first. . . then i contribute later
Re: Dynamically Copying The Content Of A Website And Displaying In Another. by mavtrevor3: 1:38pm On Jun 14, 2009
I am looking forward to seeing what he will teach me on this matter. Then i am also expecting to see what you have done so far on the snoopy script.

(1) (Reply)

Pls What's The Cheapest Platform To Send Bulk Emails / Syskay Domain Purchase Complaint / How To Add Header Image To Blogger

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 22
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.