Page 1 of 1

Hpow to call a remote script without a click

Posted: Fri Oct 04, 2002 6:01 am
by superay
Hi. I m a new player in PHP and MySQL programming. I m trying to trigger a remote PHP script from a local PHP script. I would appreciate if anyone can help me.

remote script:
http://remotedomain/updateremotedata.php?v1=x&v2=y

local script:
if($GO) { how to call the remote script above }
else { echo "remote is not called"; }

should i use exec(), system() or something else?

Posted: Fri Oct 04, 2002 6:24 am
by mydimension
unfortunately, that won't work the way you think. what will end up happening is that the remote script will be executed on the remote server and then the output will be sent to your script. if all you want is the output of that script then this is fine. however if you want to access the variables, functions and other code within that script then that is not possible (at least not that ive seen). take a look at example 12-5 on this page: http://www.php.net/manual/en/function.include.php

Posted: Fri Oct 04, 2002 7:38 am
by Takuma
Some host doesn't allow you use absolute path, but I think you can use HTTP as it saids on the manual.

Posted: Fri Oct 04, 2002 8:42 am
by mydimension
you can only use http in the include function if you have version 4.3 or greater

Posted: Sun Oct 06, 2002 9:33 pm
by superay
Thanks a lot for the responce, :D

assuming i have the permission to access the remote script, will i be able to trigger the remote script with the specify variables?

I do not need the output of the remote to be passed back to the local script. But, i need to update the remote server by running the remote script with these variables.

Is this possible??

Posted: Mon Oct 07, 2002 1:23 am
by Takuma
Yeah do something like

Code: Select all

<?php
$x = "blah blah";
$y = "blah";
include("http://remotedomain/updateremotedata.php?v1=$x&v2=$y")
?>