简体   繁体   中英

Embed a website hosted on another local machine in MVC/IIS?

I have a 3D printer which has a web interface that I can access locally (and indeed externally if I portforward to it). The problem is that port 80 is forwarded to my IIS webserver and I need to keep it that way.

I want to access the printer on port 80.

My question is, can I embed the 3D printer website in another website that I can then host on my IIS server?

I have tried using iFrames as follows but it doesn't work externally.

<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src="http://192.168.1.187:80"
style="border: 0; width:100%; height:100%;">
</iframe>

I'm guessing I'll need to pre-render the webpage locally before sending it to the client?

Please note, the 3D printer site NEEDS to be hosted on the 3D printer machine. I can't move it to IIS.

You could use the php get_file_contents function ( http://php.net/manual/en/function.file-get-contents.php ) (or the equivalent function in your server-side language of choice) and pass in a URL to the function.

If there are only a small number of pages in the 3D printer site, you could just have one php page per printer site page, each php page basically forwarding on the contents of the associated printer website page.

If there are a lot of pages, you might want to work out some kind of scheme or convention to map between the two sites and just use a single php page that takes the URL segments or query string params passed in and maps them to your 3D printer website pages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM