Skip to content

Instantly share code, notes, and snippets.

@jaderobbins
Created September 2, 2009 22:26
Show Gist options
  • Save jaderobbins/180009 to your computer and use it in GitHub Desktop.
Save jaderobbins/180009 to your computer and use it in GitHub Desktop.
Ruby/PHP combo scripts to get your external ip address.
<?php
$ip = $_SERVER['REMOTE_ADDR'];
print $ip;
?>
require 'open-uri'
open("http://your-own-server/ip.php"){ |f| /([0-9]{1,3}\.){3}[0-9]{1,3}/.match(f.read)[0].to_a[0] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment