简体   繁体   中英

Send a request to call a function from another server

I have client code in php and two servers eg apache and tomcat. I want to call a method in tomcat server through apache. Whereas apache is running in 81 port and tomcat is running in 85 port. the function which should be called is in javascript(in tomcat) . what is the php code to do this?

Am new to this please help me with explanation.

Maybe you can do something like that:

<script src="yourscript.php" type="text/javascript"></script>

where 'yourscript.php' is:

<?php
header('Content-Type: application/javascript');
echo file_get_contents("http://yourtomcat:85/yourjsfile.js");
?>

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