style="visibility: hidden"
$allowedfuncs = array([allowed function calls]) if(in_array($_get['funccall'], $allowedfuncs)) { $func = $_get['funccall']; $output = $func(); // This calls $_get['funccall']() echo $output; } else { exit(); } /* functions go here */
Hi,
I have been working on trying to figure out, how I can get a web page to call a PHP function and have the results returned to the client for processing, for about two weeks. I hope I am in the right forum (ie. Javascript). I will also post in PHP and SOAP forums as well just to be sure.
Here is the issue
PS: I don't have code to post because I really don't know how to implement this.
1. UserA loads a webpage from ServerA. In it it has a javascript function
which "on web page loading" calls a remote function on another web server, ServerB. This remote function is written in PHP and accesses a MySQL database, the results of the DB query is an array.
2. This array gets returned by the remote server to the javascript function that made the initial call. The array then gets processed by the javascript function.
Now I know that Javascript is client side and PHP is server side. I also discovered that to make this happen I will need to use some sort of RPC functionality. Some sites/ideas that I have found on the net are............
1. XML-RPC www.ashleyIT.com using JSRS
2. and possibly SOAP.
I have spent the last few days trying to get ashleyIT's XML-RPC implementation to work but the documentation is scarce, the site and forum look like they aren't being used anymore, and I am starting to wonder if there is not a more popular/modern implementation that I should be considering.
Question
So now the question. Does anyone know what implementation of RPC I could use? I am researching SOAP but so far I have not found a SOAP implementation using Javascript calling PHP functions. Is there anything else that I might be able to use other than XML-RPC and SOAP?
Thanks for your time.
The best way would be to make an ajax call, but the proposed iframe solution would work as well. You don't even have to make the iframe small, just set it's style attribute to:PHP Syntax (Toggle Plain Text)
style="visibility: hidden"
<html> <head> <script type="text/javascript"> window.onload = init_loader; function init_loader (){ var head = document.getElementsByTagName('head').item(0); document.getElementById('loader').onclick = function () { var script = document.createElement('script'); script.setAttribute( 'type', 'text/javascript' ); script.setAttribute( 'src', 'remote.php?value=my message' ); head.insertBefore( script, head.firstChild ); }; }; </script> </head> <body> </body> <a id="loader" href="#">Load Script</a> </html>
<?php // get the request $query = $_GET['value']; $query = "'".addslashes( $query )."'"; // print back as plain javascript print <<<ENDLINE alert( $query ); ENDLINE; ?>
Hi,
I have been working on trying to figure out, how I can get a web page to call a PHP function and have the results returned to the client for processing, for about two weeks. I hope I am in the right forum (ie. Javascript). I will also post in PHP and SOAP forums as well just to be sure.
Here is the issue
PS: I don't have code to post because I really don't know how to implement this.
1. UserA loads a webpage from ServerA. In it it has a javascript function
which "on web page loading" calls a remote function on another web server, ServerB. This remote function is written in PHP and accesses a MySQL database, the results of the DB query is an array.
2. This array gets returned by the remote server to the javascript function that made the initial call. The array then gets processed by the javascript function.
Now I know that Javascript is client side and PHP is server side. I also discovered that to make this happen I will need to use some sort of RPC functionality. Some sites/ideas that I have found on the net are............
1. XML-RPC www.ashleyIT.com using JSRS
2. and possibly SOAP.
I have spent the last few days trying to get ashleyIT's XML-RPC implementation to work but the documentation is scarce, the site and forum look like they aren't being used anymore, and I am starting to wonder if there is not a more popular/modern implementation that I should be considering.
Question
So now the question. Does anyone know what implementation of RPC I could use? I am researching SOAP but so far I have not found a SOAP implementation using Javascript calling PHP functions. Is there anything else that I might be able to use other than XML-RPC and SOAP?
Thanks for your time.
Hi,
I have been working on trying to figure out, how I can get a web page to call a PHP function and have the results returned to the client for processing, for about two weeks. I hope I am in the right forum (ie. Javascript). I will also post in PHP and SOAP forums as well just to be sure.
Here is the issue
PS: I don't have code to post because I really don't know how to implement this.
1. UserA loads a webpage from ServerA. In it it has a javascript function
which "on web page loading" calls a remote function on another web server, ServerB. This remote function is written in PHP and accesses a MySQL database, the results of the DB query is an array.
2. This array gets returned by the remote server to the javascript function that made the initial call. The array then gets processed by the javascript function.
Now I know that Javascript is client side and PHP is server side. I also discovered that to make this happen I will need to use some sort of RPC functionality. Some sites/ideas that I have found on the net are............
1. XML-RPC www.ashleyIT.com using JSRS
2. and possibly SOAP.
I have spent the last few days trying to get ashleyIT's XML-RPC implementation to work but the documentation is scarce, the site and forum look like they aren't being used anymore, and I am starting to wonder if there is not a more popular/modern implementation that I should be considering.
Question
So now the question. Does anyone know what implementation of RPC I could use? I am researching SOAP but so far I have not found a SOAP implementation using Javascript calling PHP functions. Is there anything else that I might be able to use other than XML-RPC and SOAP?
Thanks for your time.
<?php include(**URL OF EXTERNAL PHP CODE**) ?>
| DaniWeb Message | |
| Cancel Changes | |