1

Is there any way to create an "iframe-like" on server side ? The fact is, I need to acceed to certains page of my society's intranet from our website's administration part.

I already have a SQL link to the database that works fine, but here I would access to the pages without duplicating the source code on the webserver.

My infrasructure is the following:

The Webserver is in a DMZ and has the following local IP: 192.168.63.10. Our Intranet server is NOT in the DMZ and has the following IP: 192.168.1.20.

Our Firewall has serverals rules and I've just added the following: DMZ->LAN Allow HTTP/HTTPS traffic and LAN->DMZ Allow HTTP/HTTPS (just as we've done for the SQL redirection)

I've tried the following PHP function:

$ch = curl_init();

// set URL and other appropriate options (also tried with IP adress instead of domain)
curl_setopt($ch, CURLOPT_URL, "http://intranet.socname.ch/");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

I've also tried:

$page = file_get_contents('http://192.168.1.20/');
echo $page;

Or:

header('Location:http://192.168.1.20');

But in all thoses cases, it works fine from local but not from internet. From internet, it doesn't load and after a while, says that the server isn't responding.

Thanks for your help !

Charles
  • 50,943
  • 13
  • 104
  • 142
GRosay
  • 444
  • 10
  • 26
  • Sounds like a DNS problem. You can actually have a server that responds to http:80, acts like a server - but not itself is able to "phone out". BTW : Your localhost is also on the internet, there is no difference beside localhost probably is not visible from outside. Check your server DNS-settings! – davidkonrad Sep 05 '13 at 13:36
  • 192.168.0.0 addresses are private IP's they will not be available from the internet. You will have to create a proxy on your public facing server to fetch and re-serve content out to the world at large. – Orangepill Sep 05 '13 at 13:43

1 Answers1

1

Your first and second solution could work. Can your webserver access 192.168.1.20? (try ping 192.168.1.20 on your webserver) or resolve the Hostname intranet.socname.ch ? (try nslookup intranet.socname.ch)

What you're looking for is called "proxy", here is a simple PHP project that I found: https://github.com/Alexxz/Simple-php-proxy-script

Download the repo, copy example.simple-php-proxy_config.php to simple-php-proxy_config.php and change $dest_host = "intranet.socname.ch";

It should do the trick! (may also need to change $proxy_base_url)

Jason Leung
  • 3,819
  • 3
  • 16
  • 10
  • The webserver can ping the intranet (only when I deactivated PING blocking in firewall's settings). The proxy's code seems to be a good solution, but it's also redirect the page to : `192.168.0.1:8090/httpclient.html?u=http://intranet.socname.ch` Where 192.168.0.1 is my firewall's IP – GRosay Sep 05 '13 at 14:01
  • Never mind ! This solution work fine ! My Firewall's rules was in conflict with another and that's why it didn't work yesterday... Thanks for the answer :) ! – GRosay Sep 06 '13 at 09:40