简体   繁体   English

如何在外部PHP网址中使用函数调用

[英]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. 我知道在同一文件夹中,我可以对外部PHP文件使用include()函数,但是现在我想在另一个URL中的另一个PHP文件中调用该函数

For example, my live website ( liveexample.com/table.php ) has drop-down list and table, but without data. 例如,我的实时网站( liveexample.com/table.php )具有下拉列表和表格,但没有数据。 My another PHP file ( dataexample.com/data.php ) is connected to database and process to extracting data out. 我的另一个PHP文件( dataexample.com/data.php )已连接到数据库并处理以提取数据。 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. 我需要将[ dataexample.com/data.php ]上的数据传递到[ liveexample.com/table.php ],并让循环在[ liveexample.com/table.php ]页面上绘制包含数据的表。

Anyone has idea to design this method of delivering data from another server to another by using function call in PHP? 任何人都有想法设计这种通过使用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 ] ? 或任何其他更好的解决方案来在两个不同的服务器之间传递我的数据,例如将数据记录设置为数组并发送到[ 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. 如果使[dataexample.com/data.php]将数据输出为XML,则可以将其用作Web服务。 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. 这意味着,您可以获取XML输出(通过向请求发送数据URL),然后解析它以加载数据。 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. 一种方法就像您想要的,其他示例是通过AJAX或Flash等。

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. 正如Cristopher所说,SOAP是其中之一。

Have a great day. 祝你有美好的一天。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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