简体   繁体   中英

Generate website content from external server?

So here is the problem. I want to be able to install a file(or files) on another server A, but I want the page content to be generated by connecting to server B based on some passed parameters.

Here is the example.

So, I install the files on server A at the following location:

www.serverA.com/folder1/myfile.php

If necessary we can also put up other files in subfolders to make it work.

The user is then able to go to the following URL:

www.serverA.com/folder1/folder2/folder3/

And what the file does is it will get the text in /folder2/ and /folder3/ (this will probably require a small bit of code in an .htaccess file in /folder1/) and sends it to a specified URL on serverB. Server B then processes the information, and sends it back to Server A where the processed information is shown to the users.

For this simple proof of concept, all I need is for the programmer to implement the following:

www.serverA.com/test/3/4/

This page should send the 3 and 4 to server 4, and send back the sum (7) and multiple (12) back to SERVER A to show on the screen. To test it I should be able to change the numbers in the URL and the sum and multiple should come back correctly.

I do not want to use CURL (as it keeps giving 403 errors on my servers and I don't have access to php.ini) or file_get_contents as I have read it is not a best practice. I am open to any other options that work.

The long-term idea is to create an app that people can install on their websites that will generate content for them based on parameters they send my server.

Thanks in advance.

Would an IFrame work? A document on IFrames can be seen here: https://www.w3schools.com/tags/tag_iframe.asp

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