in reply to localhost IP in a dollar sign
---------- BEGIN /cgi-bin/ip_addr ---------- #!/bin/sh cat << __EOI__ Content-Type: text/html <html> <head> <title>ip address</title> </head> <body> <p>Your ip address is $REMOTE_ADDR.</p> </body> </html> __EOI__ ----------- END /cgi-bin/ip_addr -----------
Update: Come to think of it, my script was meant for human eyes. If you wanted something for a script to read, it would be rewritten as:
---------- BEGIN /cgi-bin/ip_addr_as_text ---------- #!/bin/sh cat << __EOI__ Content-Type: text/plain $REMOTE_ADDR __EOI__ ----------- END /cgi-bin/ip_addr_as_text ----------- ---------- BEGIN client code ---------- use LWP::Simple (); $content = LWP::Simple::get("http://bla/cgi-bin/ip_addr_as_text"); die(...) unless (LWP::Simple::is_success()); chomp($content); ----------- END client code -----------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |