Hi, I'm trying to get a value from a remotely executed script (on another server). From what I've read, it should work as both servers are running php 4.4 and have allow_url_fopen "on" to do something like this: remote server (myfile.php): return 0; PHP: local server: $get_value = include("http://www.remoteserver.com/myfile.php"); PHP: For some reason, I just keep getting the integer '1' (or bool TRUE) returned to $get_value from the call to include but when you have a return statement in the file you are calling with include(), it should give the value returned from that script. I can't access any variables that are set in the remote script and I can't run this script on the local server. Anyone know how to get this to work? Thanks.
after include statement call the function which return a value $get_value = include("http://www.remoteserver.com/myfile.php"); $some_variable = functionCall($param); PHP: Well, I guess. Not sure about it
hi, i think including a file that resides on another server is not allowed its a surefire security risk, your best bet if you want to get a value from another server is through SOAP or RPC
I agree with TwistMyArm, to read the remote data with file_get_contents(). However, to do that you should be printing/echoing the return data, not using "return" in myfile.php. So the remote myfile.php would look something like: <?php $returnValue = "0"; print $returnValue; ?> PHP: And your local script could have something like: <?php $get_value = file_get_contents("http://www.remoteserver.com/myfile.php"); ?> PHP:
Ah..cool! It works with file_get_contents(). I tried something like that earlier but I didn't think of file_get_contents() to retrieve the output. Thanks for the responses...green props.