Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2006, 08:22 AM
WebProWorld New Member
 

Join Date: Oct 2004
Location: England
Posts: 24
wickywills RepRank 0
Default Displaying another website's content.....how?

I've just been given the task of writing something that pulls back bits of information from another website and displays it in our one, but what we need is rather complicated, so if one of the gurus here can help point me in the right direction, that would be most appreciated.

Basically, there is a webpage on another website which holds a table (standard html table), and what i need to do is some way pull back JUST that table into our website (ideally in our style). I found a website for displaying another website's content in mine, but for that i might well just have used an iFrame. I actually want to pull back a specific part of a website, not the whole page.

I'm pretty sure this is possible, but wouldn't know where to begin.

can anyone help?

thanks in advance!
James
Reply With Quote
  #2 (permalink)  
Old 07-07-2006, 09:31 AM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,402
kgun RepRank 3kgun RepRank 3kgun RepRank 3
Default

We did exactly that on a XP (XtremeProgramming) project at the university of Bergen. Students should be able to make their own "virtual museum" by pulling information from the Bergen Museum Website.

The code is written in Java. I can send the code to you privately. If you understand Java, it should be simple to copy and paste that code.

Do not make the code into an advanced site crawler.

But you have to call me first.

Phone number +47 908 56 319.
Reply With Quote
  #3 (permalink)  
Old 07-07-2006, 10:37 AM
WebProWorld New Member
 

Join Date: Oct 2004
Location: England
Posts: 24
wickywills RepRank 0
Default

Quote:
Originally Posted by kgun
We did exactly that on a XP (XtremeProgramming) project at the university of Bergen. Students should be able to make their own "virtual museum" by pulling information from the Bergen Museum Website.

The code is written in Java. I can send the code to you privately. If you understand Java, it should be simple to copy and paste that code.

Do not make the code into an advanced site crawler.

But you have to call me first.

Phone number +47 908 56 319.
Thanks very much for the reply kgun.

Unfortunantly, i have little (if any) experience with Java, though i'm used to pulling bits of code and putting them together etc.

At the moment, i have the following code in asp:

Code:
<%
Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.Open "GET", "WEB ADDRESS HERE", false
objHTTP.Send
Response.Write "this is the content"
%>
<%Response.Write objHTTP.ResponseText%>
The above just gets the target website and response.write's it whereever i want. This is one step to my goal, as now i can just put some CSS styling on it so that i can have it displayed how i want, however i only want the code inside the html Table tags to be pulled back.

Do you know how to do this through ASP? I'd prefer it in ASP as i'm more familier with it.

thanks again for the help[/code]
Reply With Quote
  #4 (permalink)  
Old 07-07-2006, 04:02 PM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,402
kgun RepRank 3kgun RepRank 3kgun RepRank 3
Default

Quote:
Originally Posted by wickywills
Do you know how to do this through ASP? I'd prefer it in ASP as i'm more familier with it.
No, I do not know ASP.

Quote:
Originally Posted by wickywills
Basically, there is a webpage on another website which holds a table (standard html table), and what i need to do is some way pull back JUST that table into our website (ideally in our style).
If that is the only thing you want, that can not be so difficult. Do you have an overview of ASP functions (function browser) and ASP class libraries (class browser)? May be the right Google search is enough.
Reply With Quote
  #5 (permalink)  
Old 07-07-2006, 04:15 PM
kgun's Avatar
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,402
kgun RepRank 3kgun RepRank 3kgun RepRank 3
Default

Quote:
Originally Posted by wickywills
however i only want the code inside the html Table tags to be pulled back.
Sounds like a function / class.
Reply With Quote
  #6 (permalink)  
Old 07-18-2006, 02:05 PM
WebProWorld Pro
 

Join Date: Aug 2003
Location: UK
Posts: 132
irodgers RepRank 0
Default String functions

I think you could do it in php (and therefore asp too) by using string functions. But that solution would be a bit messy. You would need to look for <table </table - and get everything between those tags.
Cant be bothered to think about it too much so I had a quick look on the web and found this -


<?php

function get_string_between($string, $start, $end){
$string = " ".$string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini;
return substr($string,$ini,$len);
}

$string = "this [custom] function is useless!!";
echo get_string_between($string,"[","]");
// must return "custom";
?>

acknowledgements to - http://uk2.php.net/strings

I'm told asp is very similar to php.

By the way I hope you're going to acknowledge the source of the material!
__________________
Markgreat
Homes by Speyside
Tickets!
Reply With Quote
  #7 (permalink)  
Old 07-20-2006, 09:53 AM
Vectorman211's Avatar
WebProWorld Member
 

Join Date: Jul 2006
Posts: 89
Vectorman211 RepRank 2
Default

The problem is that the content is most likely dynamic, which is why you want to include it on your site dynamically rather than a simple copy and paste. Since it is dynamic, hard-coding a starting and ending position into the string search is futile. However, if the programmer of the site used a unique ID for the table you may be in luck. Example: <table id="table1"></table>. you can then use "<table id="table1"> as your starting point. It's also possible that it's the ONLY table on the page which would simplify things even more.

You can retreive the entire context of a web page with PHP by using the file_get_contents() function. Example: $page_data=file_get_contents("www.google.com"). This will return the full HTML of the page.
Reply With Quote
  #8 (permalink)  
Old 07-20-2006, 09:14 PM
WebProWorld Pro
 

Join Date: Aug 2003
Location: UK
Posts: 132
irodgers RepRank 0
Default Dynamic - yes

So long as the site DOES use tables you dont have to worry about the whole <TABLE xxxx> or <table yyy> tag. You cant rely on the tag always being <table> with an end </table> - but you can still do it with string commands.

But if the site uses css, with no tables, you might struggle a bit. Why bother? There are lots of sites offering rss feeds. You're bound to find something in rss format.
__________________
Markgreat
Homes by Speyside
Tickets!
Reply With Quote
  #9 (permalink)  
Old 07-21-2006, 12:30 AM
Vectorman211's Avatar
WebProWorld Member
 

Join Date: Jul 2006
Posts: 89
Vectorman211 RepRank 2
Default

Good point, it could be displayed in div boxes and positioned with CSS but I doubt it. Tabular data should still be displayed in tables as they are not obsolete. As to the RSS feed, obviously that's the preferred way to display another site's content but I think in this guy's case he wants content from a specific site that does not offer it in an RSS feed.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0