• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

php code to display proboards forum in a web page?

alley

Social Nutwork
NLC
I want to embed my proboard forum in an html page.
ButyYou can't put your proboard forum in an iframe, since Proboards is designed to break out of them

I guess the only way to get a Proboards forum to display on a different site would be with PHP? Is this possible?
 
Override.

http://www.howtocreate.co.uk/emails/Doug.html said:
Doug,

> Now the problem is that some websites have "frame breakout" scripts.
> When the iframe loads these pages they automatically takes over the
> entire session

You are quite right, the cross domain resrictions would make this pretty
much impossible to avoid. You cannot load their page into an iframe if they
refuse to allow it.

In theory, you can use an object instead, but IE would almost certainly fail
at this.

> PS. I also thought of redefining the "top" object or overriding its
> properties or methods.

'top' is a property unique to each frame, so you cannot override the child's
'top' from the parent frame. However, since 'top' and 'top.location' are
objects, you may be able to delete them (not sure how successful this might
be):
delete location; //this way, they can't change it.

The most reliable way to do what you need is a url proxy, but this would eat
your bandwidth, and you would need to change the base href of the page to
reflect its original location (so that all the links and images work);

Code:
<iframe src="getPage.php?url=http://example.com/"></iframe>

then in getPage.php:
<?
if( preg_match("/^http:\/\//",$_GET['url']) ) {
 if( $file = fopen($_GET['url'],'rb') ) {
  $contents = '';
  $base = '<base href="'.urlencode($_GET['url']).'">';
  while( !feof( $file ) ) { $contents .= fread( $file, 8192 ); }
  if( stristr( $contents, '</html>' ) ) {
    $contents = preg_replace("/<\/html>/i",$base.'</html>',$contents);
  } else {
    $contents = $base.$contents;
  }
  //this regexp may have an ugly effect on some pages - you will need to
  //tailor the regexp to suit your needs.
  $contents = preg_replace("/(=|\s|\()top\b/i","$1".'window',$contents);
  print $contents;
 }
}
?>


Hope this helps

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/


Hope this helps.
 
He's saying create a file named getPage.php, and in it put
PHP:
<?
if( preg_match("/^http:\/\//",$_GET['url']) ) {
 if( $file = fopen($_GET['url'],'rb') ) {
  $contents = '';
  $base = '<base href="'.urlencode($_GET['url']).'">';
  while( !feof( $file ) ) { $contents .= fread( $file, 8192 ); }
  if( stristr( $contents, '</html>' ) ) {
    $contents = preg_replace("/<\/html>/i",$base.'</html>',$contents);
  } else {
    $contents = $base.$contents;
  }
  //this regexp may have an ugly effect on some pages - you will need to
  //tailor the regexp to suit your needs.
  $contents = preg_replace("/(=|\s|\()top\b/i","$1".'window',$contents);
  print $contents;
 }
}
?>

And then instead of
HTML:
<iframe src="http://example.com/"></iframe>
put
HTML:
<iframe src="getPage.php?url=http://example.com/"></iframe>
 
try giving the iframe a name (name="") like "top" or "main" or something.. try and fool proboards. Have a look and see what their javascript looks for to break out of frames.
 
I think it's a little bit beyond my knowledge Colin,. but if you want to try I can PM you the link to my proboard forum?

I would really appreciate it. Thanks for your help on this. :)

try giving the iframe a name (name="") like "top" or "main" or something.. try and fool proboards. Have a look and see what their javascript looks for to break out of frames.
 
time to beat this dead horse again but I still have an interest in seeing if this is possible as I still use a few proboards forums.
Can anybody help with this? ...I seem to have lost Collin's codes.

Thanks
 
because I want to make it part of my site's layout

I'd highly suggest just hosting your forum on your own website.


What you are trying to do is create a proxy to load the proforum page and then convert all links to open in getPage.php?url=http://blablablapage.com/someforum instead of http://blablablapage.com/someforum

It will be resource intensive on the server your PHP file is hosted on, and your account can be banned if it is shared because it contains a proxy.
 
Ok .. no biggy. Just was wondering if it could be done and or was worth it. Sounds pretty much not worth it. Thanks guys!
 
I don't like paid web hosting though. I have found them to me more unreliable than free hosts.
 
Back
Top