+ Post New Thread
Results 1 to 15 of 15
Web Development Thread, display a website within another website in Coding and Web Development; not sure if the title makes sense, but ill try to explain what Im trying to do. I have a ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200

    display a website within another website

    not sure if the title makes sense, but ill try to explain what Im trying to do.

    I have a number of network devices that have embedded http servers in them. I only have 1 static IP, and port 80 is forwarded to my web server. Im looking for a way of making a couple of pages on that web server, that will embed the pages from the various other servers,, within the page.

    I had one idea of using the very same php proxy thing thats used to get to facebook.com etc, but it didnt give me access to internal 192.168.x.x addresses..

    Is there a known / standard way to do what im wanting to do, or should I have a go at hacking up the php proxy thing to allow access through to 192.x addresses?

  2. #2
    Cools's Avatar
    Join Date
    Jan 2009
    Location
    Bedfordshire
    Posts
    498
    Thank Post
    24
    Thanked 62 Times in 57 Posts
    Rep Power
    25
    <iframe> http://www.crapsite.co.uk</iframe>
    but you cant access a internet ip from a external site.
    you will have to do a subdomain "site2.domain.co.uk" and do som dns stuff and forward it to the web server with on NAt with the pages on..

    it all sounds good in my head..
    Last edited by Cools; 24th July 2009 at 11:51 AM.

  3. #3
    p858snake's Avatar
    Join Date
    Dec 2008
    Location
    Queensland
    Posts
    1,490
    Thank Post
    37
    Thanked 175 Times in 151 Posts
    Blog Entries
    2
    Rep Power
    51
    could you perhaps forward them to ports other than 80?

  4. #4

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    18,130
    Thank Post
    522
    Thanked 2,540 Times in 1,975 Posts
    Blog Entries
    24
    Rep Power
    875
    Use reverse proxying. Running a Reverse Proxy with Apache:

    Or use port forwarding.

  5. #5

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    Port forwarding I had thought of, but the embedded http servers of the devices don't have any authentication, so if i forwarded say port 8000 on the router to port 80 on the LAN device, it would just give direct access.

    I was hoping to somehow just create a page, with htaccess set up for authentication, that would have a link that I could just click that would bring the other http server to the current page.

    Ill have a look at reverse proxy-ing, but I feel it might just be a bit

    @ Cools: Im a bit lost...

    I think it might just be a bit easier to hack apart the php-proxy thing.. Ill give it a go..

  6. #6

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    18,130
    Thank Post
    522
    Thanked 2,540 Times in 1,975 Posts
    Blog Entries
    24
    Rep Power
    875
    Quote Originally Posted by RabbieBurns View Post
    Port forwarding I had thought of, but the embedded http servers of the devices don't have any authentication, so if i forwarded say port 8000 on the router to port 80 on the LAN device, it would just give direct access.

    I was hoping to somehow just create a page, with htaccess set up for authentication, that would have a link that I could just click that would bring the other http server to the current page.

    Ill have a look at reverse proxy-ing, but I feel it might just be a bit

    @ Cools: Im a bit lost...

    I think it might just be a bit easier to hack apart the php-proxy thing.. Ill give it a go..
    I'd say your best solution would be a mix of reverse proxying and adding authentication to your apache config file for the entire domain (or whatever you wish to do).

    It is very simple in the end. ie. enable mod_proxy (i have mod_proxy, mod_proxy_connect, mod_proxy_http, mod_proxy_ftp enabled), then add the following lines to your conf file:

    ProxyRequests Off
    ProxyPass /blah http://192.168.1.1
    ProxyPassReverse /blah http://192.168.1.1

    Then you can add your usual auth block and voila.

  7. #7

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    If your main page can be ASP or PHP then it's easy - you get the public web server to call the pages from each of the internal devices. something like this should work (save this as status.asp on your web server, for example)

    <%
    response.write GetPage("http://192.168.0.1/statuspage")
    response.write GetPage("http://192.168.0.2/statuspage")

    Function Getpage(sURL)
    Set oXML = CreateObject("Msxml2.ServerXMLHTTP")
    oXML.Open "GET", sURL, False 'false means wait for page
    oXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    oXML.Send
    GetPage=cstr(oXML.responseText)
    Set oXML = nothing
    end function



    %>

  8. #8

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    Quote Originally Posted by srochford View Post
    If your main page can be ASP or PHP then it's easy - you get the public web server to call the pages from each of the internal devices. something like this should work (save this as status.asp on your web server, for example)

    <%
    response.write GetPage("http://192.168.0.1/statuspage")
    response.write GetPage("http://192.168.0.2/statuspage")

    Function Getpage(sURL)
    Set oXML = CreateObject("Msxml2.ServerXMLHTTP")
    oXML.Open "GET", sURL, False 'false means wait for page
    oXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    oXML.Send
    GetPage=cstr(oXML.responseText)
    Set oXML = nothing
    end function



    %>
    Thats exactly the kind of thing Im looking for. Most my sites are php so thats no problem.. Is there a php equivelent of that code?

  9. #9

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    before I start looking at localzuk's method, could anyone tell me if there is anything obvious in this that I could change that would allow it to access a local IP...

    When I try it currently, i get the blacklisted blah error message:

    edugeek private pastebin - collaborative debugging tool

    cheers

  10. #10

    Join Date
    Jan 2007
    Location
    Durham, UK
    Posts
    328
    Thank Post
    33
    Thanked 17 Times in 12 Posts
    Rep Power
    20
    Quote Originally Posted by RabbieBurns View Post
    before I start looking at localzuk's method, could anyone tell me if there is anything obvious in this that I could change that would allow it to access a local IP...

    When I try it currently, i get the blacklisted blah error message:

    edugeek private pastebin - collaborative debugging tool

    cheers
    I take it thats phproxy. The code for the blacklisting is in a different file (index.php i think).
    Actually yes it is, ive just looked.

    PHP Code:
    $_hosts             = array

                        (

                            
    '#^127\.|192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[01])\.|localhost#i',
                        ); 
    Look for that in index.php and if you change it so its

    PHP Code:
    $_hosts             = array

                        (

                        ); 
    should do the trick me thinks. (i havent had time to check)

    Jack

  11. Thanks to Jackd from:

    RabbieBurns (24th July 2009)

  12. #11

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    Quote Originally Posted by RabbieBurns View Post
    Thats exactly the kind of thing Im looking for. Most my sites are php so thats no problem.. Is there a php equivelent of that code?
    Yes; look up curl - the example here will probably do what you want: PHP: Using PHP's cURL module to fetch the example.com homepage - Manual

  13. #12

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    i was looking at the wrong file.. cheers

    that works for giving me access to the things i want, but fails miserably to display the things I want.

    thanks though,

    ill need to try the other way

  14. #13

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    Quote Originally Posted by srochford View Post
    Yes; look up curl - the example here will probably do what you want: PHP: Using PHP's cURL module to fetch the example.com homepage - Manual
    ^^ Previous reply was for jack..

    Thanks, Ill give that a look. Cheers

  15. #14

    Join Date
    Jan 2007
    Location
    Durham, UK
    Posts
    328
    Thank Post
    33
    Thanked 17 Times in 12 Posts
    Rep Power
    20
    Quote Originally Posted by RabbieBurns View Post
    i was looking at the wrong file.. cheers

    that works for giving me access to the things i want, but fails miserably to display the things I want.

    thanks though,

    ill need to try the other way
    what exactly is wrong with it?

    If you used cURL wouldnt you have to do some sort of url-rewriting for the pages to be useable?

    & in my personal opinion i would use the reverse proxy method localzuk suggested.

    Jack

  16. #15

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    I added this:

    Code:
    <?php
    
    $ch = curl_init("http://192.168.2.249");
    $fp = fopen("MainMenu.htm", "w");
    
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    
    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    ?>
    and it flashes up this for a second,



    and then goes to
    Code:
    Not Found
    
    The requested URL /MainMenu.htm was not found on this server.

SHARE:
+ Post New Thread

Similar Threads

  1. Font display on website!
    By marvin in forum Windows
    Replies: 3
    Last Post: 6th May 2009, 01:34 PM
  2. New Website
    By itgeek2008 in forum Web Development
    Replies: 10
    Last Post: 6th April 2009, 03:35 PM
  3. website
    By tomscaper in forum General Chat
    Replies: 18
    Last Post: 22nd January 2009, 04:20 PM
  4. We need a new website and I need help... please?
    By elsiegee40 in forum EduGeek Joomla 1.5 Package
    Replies: 9
    Last Post: 20th January 2009, 08:53 PM
  5. Website
    By ticker in forum General Chat
    Replies: 4
    Last Post: 25th April 2008, 07:22 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •