Is there a way to display external web pages without iframes? Maybe using php or js...? If so how would I go about doing this...? Any help would be much appreciated...

Thanks,
Lil Chris

Comments

VM’s picture

what kind of page to be included ?

a php page? if so you may be able to create a page content type and then use an include statement to pull the page.

if its an html page ? it may be easier to just use the page content and enter the full html to the page no?

Phillip Mc’s picture

Are the external pages on the same server as the Drupal installation or on an external server?

I was asked how to display external (dynamic) web content recently and looked into it. I came across a php snippet that allowed you to "scrape" an external web page and display the content.

Can't remember where but if you're stuck I can probably dig it out for you.

Phil

webcat’s picture

Phil:

I'd be interested in that php code if you can find it... we've been asked to display static content from an affiliated govt site, some html, some pdf as is. If we create content objects in Drupal and paste in the content, we'll be out of luck if the original source content changes. So some code to "scrape" external content would really help. Thanks!

- Cat

Lil Chris’s picture

This may sound silly, but I don't know... (i'll explain)

I'm trying to use this:

<table height="500" width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td><iframe id="content" style="WIDTH: 100%; HEIGHT: 400" name="content" src="http://search.har.com/idx/doSearch.cfm?cid=549793&amp;siteType=AWS&amp;leadid=3&amp;ALLMLS=N" frameborder="0" width="100%" scrolling="no" height="400"></iframe></td>
</tr>
</tbody>
</table>

I'm trying to pull in a page from the houston association of realtors, which is currently working (but I had to turn off something in my McAfee to get it to work, block advertisements) using iframes.

I was wondering if there is a proper way to do this, that will work reguardless of my Security software. I not necessairly worried about me, just other clients.

Here is the page if you care to look:
http://eaglerock-usa.com.s2976.gridserver.com/node/16

Thanks,
Lil Chris

styro’s picture

iframes are one of the only ways to include a complete HTML page in another complete HTML page. You can't easily just slot the entire content in because the HTML won't be valid anymore - eg two different html, head and body elements.

Of course iframes are generally an ugly solution - and you've found one reason. Because they are handled at the client browser and have been the vector for vulnerabilities etc in the past, they can be blocked at the client and you the webmaster have no control over that.

Basically it sounds like you'll need to screenscrape the page you want and mangle the content enough (eg just using what is inside the body element as a bare minimum) before you can include it at the server side using PHP. This of course isn't a novice level task and potentially leaves you open to the other site changing its markup and breaking your pages. So this is still somewhat of an ugly solution for other reasons.

A better solution would generally be for the other site to offer an API of some sort to get the data that doesn't involve screen scraping and mangling HTML. It would still involve coding though, it's just that it would be a little more robust and elegant.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ

Lil Chris’s picture

I was kind of afraid of that...

Question:
What is an API...? I'm not familiar with that...

gonzocoder’s picture

An API is an Application Programming Interface. It's basically something that lets you plug into services offered by another site (Google Maps being a good example). Although that is a very simple explanation for something quite complex.

Following on from our conversation earlier, I did have a little look around and found this post http://drupal.org/node/40756 which sounds like it should do what you want, but doesn't quite. It brings in the whole page with all of the properties listed rather than just the one you want to display. Maybe someone here knows a way this could be modified for your purposes? It's beyond my knowledge.

Good luck with this.

It's 1.30am here in the UK, so I'm of to catch some z's!

Gonz

Lil Chris’s picture

Thank you Gonz for following up and everyone else who offered assistance...

I think i'll just put a link up that points to a pop-up that has frames (if they can't see the page), I know that'll work... It's crude but most realtor sites are crude like that anyway... Like you said, there is probably better and more complex ways of doing this, but it's for a (non-paying) relative... So, He kinda gets what he pays for. Problem solved...

Thanks again,
Lil' Chris