简体   繁体   中英

How to use function call in external PHP url

I understand that within same folder, I can use include() function for external PHP file, but now I would like to call the function in another PHP file which located in another URL.

For example, my live website ( liveexample.com/table.php ) has drop-down list and table, but without data. My another PHP file ( dataexample.com/data.php ) is connected to database and process to extracting data out. But, it is in another server.

I need to make my data on [ dataexample.com/data.php ] delivers to [ liveexample.com/table.php ] and let the looping to draw table with data out on [ liveexample.com/table.php ] page.

Anyone has idea to design this method of delivering data from another server to another by using function call in PHP?

Or any other better solution to deliver my data between two different servers such as make the data record set into array and send to [ liveexample.com/table.php ] ?

Please give me advise or consultation. Appreciate much!

我认为SOAP Web服务非常适合您实现所需的功能,但是如果可能的话,只需从单独的服务器复制相同的代码即可。

If you make [dataexample.com/data.php] output your data as XML, then you can use it as a web service. What that means is, you can take that XML output (by sending a request the the data URL), and then parse it to load the data. This way, you can use that service any way you want. One way would be like you wanted, other examples would be via AJAX, or Flash etc.

So here are a few topics worth looking into:

I hope this will give a pretty good idea of how to achieve what you want to accomplish, because there a few options you can go by. Like Cristopher said, SOAP is one of them.

Have a great day.

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