RabbieBurns (24th July 2009)

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?
<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 12:51 PM.
could you perhaps forward them to ports other than 80?

Use reverse proxying. Running a Reverse Proxy with Apache:
Or use port forwarding.

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.
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
%>


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.
Look for that in index.php and if you change it so itsPHP Code:$_hosts = array
(
'#^127\.|192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[01])\.|localhost#i',
);
should do the trick me thinks. (i havent had time to check)PHP Code:$_hosts = array
(
);
Jack
RabbieBurns (24th July 2009)
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

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


I added this:
and it flashes up this for a second,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 then goes to
Code:Not Found The requested URL /MainMenu.htm was not found on this server.
There are currently 1 users browsing this thread. (0 members and 1 guests)