On a site im working on, instead of using frames, we are using a php
function to include html from a 3rd party site (a message board from a 3rd
party). so lets say the top and left are our code, but the center section
will be the message board - like this:
($z is a url that comes into this page like
http://www.domain2.com/test.php?z=http://www.yahoo.com)
part of current code:
<?php if ($z == "$z") { include ("$z"); } elseif ($z == "") { include
("main.html"); } else { include ("main.html"); } ?>
(it will then output the html in the php file AND the html from
www.yahoo.com)
anyway, i know in perl i can do this, but im unsure if i can do this in php
(im sure u can) or how to do it:
maybe instead of using include - take the $z url, put the html data it gets
from that url and puts it into a variable and then change all links within
that variable. so if a link in the original html says
http://www.yahoo.com/whatever.html it would change it to
http://whatever.php?z=http://www.yahoo.com/whatever.html. by doing this the
final outputted text will act like its within a frame even when u click on
any links within the external url's html code.
hahah i dont know if that is clear or not so here is a full example.
1) original html to include : http://www.domain1.com/whatever.html
2) contents of original whatever.html: This is a link to msn <a
href=http://www.msn.com> http://www.msn.com</a>. Ok?
3) php file (with what code?): http://www.domain2.com/test.php
4) full php link:
http://www.domain2.com/test.php?z=http://www.domain1.com/whatever.html
5) output text: This is a link to msn <a
href=http://www.domain2.com/test.php?z=http://www.msn.com>http://www.msn.com
</a>. Ok?
Can anyone help? hehe :)
--
Steve
> On a site im working on, instead of using frames, we are using a php
> function to include html from a 3rd party site (a message board from a 3rd
> party). so lets say the top and left are our code, but the center section
> will be the message board - like this:
>
> ($z is a url that comes into this page like
> http://www.domain2.com/test.php?z=http://www.yahoo.com)
>
> part of current code:
>
><?php if ($z == "$z") { include ("$z"); } elseif ($z == "") { include
> ("main.html"); } else { include ("main.html"); } ?>
It ought to work. include() can use a local file or an url (on Unix at
least). Do you get any errors, or is this just conceptual code?
Anyway, you probably should do
$z = $_GET('z')
and not just '$z' depending on your PHP register_globals setting.
Read more here: http://se.php.net/manual/en/function.include.php
In a fit of excitement on 6 Mar 2003 17:18:22 GMT, Martin Wickman
<wiz...@hotbrev.com> managed to scribble:
> > ($z is a url that comes into this page like
> > http://www.domain2.com/test.php?z=http://www.yahoo.com)
> >
> > part of current code:
> >
> ><?php if ($z == "$z") { include ("$z"); } elseif ($z == "") {
> >include
> > ("main.html"); } else { include ("main.html"); } ?>
>
> It ought to work. include() can use a local file or an url (on Unix
> at least).
It does work, providing the extension of the file being included
isn't a parsed PHP extension. For example:
include('http://foo.com/bar.php');
will fail (I forget the exact wording of the error) if .php files are
configured to be parsed as such on foo.com.
Regards,
Ian
PS: It works on windoze too.
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPmeEc2fqtj251CDhEQJeLACeNwZPIpF85yn1FzFA07xE0s7wfrEAnA+s
TTCM+5giuIy7GS0rGnELRAnX
=plgQ
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Scripting, Web design, development & hosting.
The include works fine on its own. the question was more about how to
changle the links inside the html that is pulled from the 3rd party site.
any suggestions?
1) original html to include : http://www.domain1.com/whatever.html
2) contents of original whatever.html: This is a link to msn <a
href=http://www.msn.com> http://www.msn.com</a>. Ok?
3) php file (with what code?): http://www.domain2.com/test.php
5) output text: This is a link to msn <a
href=http://www.domain2.com/test.php?z=http://www.msn.com>http://www.msn.com
</a>. Ok?
"Martin Wickman" <wiz...@hotbrev.com> wrote in message
news:slrnb6f0n9....@localhost.localdomain...
The include works fine on its own. the question was more about how to
changle the links inside the html that is pulled from the 3rd party site.
any suggestions?
1) original html to include : http://www.domain1.com/whatever.html
2) contents of original whatever.html: This is a link to msn <a
href=http://www.msn.com> http://www.msn.com</a>. Ok?
3) php file (with what code?): http://www.domain2.com/test.php
5) output text: This is a link to msn <a
href=http://www.domain2.com/test.php?z=http://www.msn.com>http://www.msn.com
</a>. Ok?
-Steve