Forum Moderators: coopster
i need to run a script on my server so it can be seen by another server on the internet wich olny grabs the the remote ip and writes it to a file every time the file is called by the server behind the router.
Thank u in advance for any help.
saludos desde playa del carmen mexico
$output=<<<HTML
<html>
<body>
<a href="${_SERVER['REMOTE_ADDR']}">${_SERVER['REMOTE_ADDR']}</a>
</body>
</html>
HTML
;
$file=@fopen ("/path/to/your/file.html","w");
@fwrite($file,$output);
@fclose($file);
Hope that helps
echo $ip;
Here is another way.
Yes, I finally managed to run the script to write the ip from my server behind a linksys firewall into a file in a server on the internet.
The mayor problem I had was with the crontab facility.
I had a file called post-ip with:
#!/bin/bash
/usr/bin/lynx -dump [webaddress...] >> /dev/null
and I wanted to run it with
crontab */30 * * * * /home/root/post-ip
If I executed the file from the shell it worked and the ip was udated on the server in the internet. But once I tried with crontab I was getting an error message via email telling me that my terminal was unable to clear the screen neither position the cursor.
I tried an tried until I learn that the problem was with lynx it does not like to be run hidden, it needs the shell. So now im using curl instead and it works like magic.
Thank you all for this forum.