By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,492 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,492 IT Pros & Developers. It's quick & easy.

use a local php script to execute a remote php script and return results?

P: n/a
Basically, can I execute a php script from within a php script? Heres
some details:

I'm using a remote script to get my local ip address using
$HTTP_SERVER_VARS['REMOTE_ADDR'];

This works. Now I want to run a local php script to call the remote
script and return my ip address. Any Ideas? Thanks! -bp
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
jn
"miles111" <pl******@pilot.msu.edu> wrote in message
news:e7**************************@posting.google.c om...
Basically, can I execute a php script from within a php script? Heres
some details:

I'm using a remote script to get my local ip address using
$HTTP_SERVER_VARS['REMOTE_ADDR'];

This works. Now I want to run a local php script to call the remote
script and return my ip address. Any Ideas? Thanks! -bp


Why not use $_SERVER['SERVER_ADDR']?
Jul 17 '05 #2

P: n/a
Regarding this well-known quote, often attributed to miles111's famous "20
Jan 2004 21:44:16 -0800" speech:
Basically, can I execute a php script from within a php script? Heres
some details:

I'm using a remote script to get my local ip address using
$HTTP_SERVER_VARS['REMOTE_ADDR'];

This works. Now I want to run a local php script to call the remote
script and return my ip address. Any Ideas? Thanks! -bp


Just use a GET redirect (Assuming you're running Apache+php on your local
system):

To get an IP from local to remote (in a script running locally):
header("Location: http://remoteserver.com/ip.php?local=$myIPAddress")

To get an IP from remote to local (in a script running remotely):
header("Location: http://127.0.0.1/ip.php?remote=$theirIPAddress")

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.