PHP Embedding?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Logicus
    Member
    • Mar 2004
    • 36

    PHP Embedding?

    Let's say I have site1.net and site2.net both on the same server, and I would like site2.net to take content directly from site1.net/index.php?page=site2, but I don't want to have to use a redirect, because site2.net should remain somewhat autonomous from site1.net.

    Is that possible?
  • Martz
    Senior Member
    • Apr 2001
    • 1051

    #2
    You can do an include if your php allows fopen:

    Code:
    $var = fopen("http://site1.net/functions.php", "r");
    $rav = fopen("http://site2.net/includefile.txt", "r");
    etc
    HP DL-380 G6, 2x E5520, 28GB RAM, 4x300GB SAS, VMWare ESXi
    -
    Unreal Tournament : Assault forums - irc://irc.utassault.net:6667 -

    Comment

    • Logicus
      Member
      • Mar 2004
      • 36

      #3
      Thanks! I'll have to try this later today.

      Comment

      • MrNase
        Senior Member
        • Jun 2003
        • 3575
        • 3.8.x

        #4
        Originally posted by Martz
        You can do an include if your php allows fopen:

        Code:
        $var = fopen("http://site1.net/functions.php", "r");
        $rav = fopen("http://site2.net/includefile.txt", "r");
        etc
        Iam sowhat glad that this isn't working

        If that would work I could just fopen vbulletin.com's config.php and have some fun with it..

        fopen just grabs whatever the page's content is you want to grab.


        Let's look at an example:

        You have a php script which echoes 'test'. When you fopen it you'll get 'test' as a string.

        But you just get the output and not the sourcecode of your test php file.

        If you try to include a php-file which has no output (a file with database information) fopen will return an empty string.
        That's the end of that!

        Comment

        • Logicus
          Member
          • Mar 2004
          • 36

          #5
          Originally posted by MrNase
          Iam sowhat glad that this isn't working

          If that would work I could just fopen vbulletin.com's config.php and have some fun with it..

          fopen just grabs whatever the page's content is you want to grab.


          Let's look at an example:

          You have a php script which echoes 'test'. When you fopen it you'll get 'test' as a string.

          But you just get the output and not the sourcecode of your test php file.

          If you try to include a php-file which has no output (a file with database information) fopen will return an empty string.
          Yes, that makes sense... I think...

          For now, I decided just to copy and past the html and have a static frontpage on the secondary site, but I think it might also be possible to use one big iframe and have everything target=index. However, that's a little more tricky that I'd like, so I'm not going to try it for my current project.

          Comment

          • RagingPenguin
            Senior Member
            • Apr 2004
            • 896
            • 3.0.8

            #6
            You trying to use one config.php to drive two sites?

            Comment

            • Martz
              Senior Member
              • Apr 2001
              • 1051

              #7
              Originally posted by MrNase
              Iam sowhat glad that this isn't working

              If that would work I could just fopen vbulletin.com's config.php and have some fun with it..

              fopen just grabs whatever the page's content is you want to grab.


              Let's look at an example:

              You have a php script which echoes 'test'. When you fopen it you'll get 'test' as a string.

              But you just get the output and not the sourcecode of your test php file.

              If you try to include a php-file which has no output (a file with database information) fopen will return an empty string.
              Isn't this what the user wanted to do? Grab content from site1 on site2 and vice versa?

              So why are you going on about grabbing the config.php from this web site??? I know I called the name functions.php in my example.
              HP DL-380 G6, 2x E5520, 28GB RAM, 4x300GB SAS, VMWare ESXi
              -
              Unreal Tournament : Assault forums - irc://irc.utassault.net:6667 -

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...