Hpow to call a remote script without a click

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
superay
Forum Newbie
Posts: 4
Joined: Fri Oct 04, 2002 6:01 am
Location: Malaysia

Hpow to call a remote script without a click

Post 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?
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post 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
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Some host doesn't allow you use absolute path, but I think you can use HTTP as it saids on the manual.
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

you can only use http in the include function if you have version 4.3 or greater
superay
Forum Newbie
Posts: 4
Joined: Fri Oct 04, 2002 6:01 am
Location: Malaysia

Post 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??
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Yeah do something like

Code: Select all

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