Skip to Content.
Sympa Menu

discuss - Re: [opennic-discuss] The website

discuss AT lists.opennicproject.org

Subject: Discuss mailing list

List archive

Re: [opennic-discuss] The website


Chronological Thread 
  • From: Brian Koontz <brian AT opennicproject.org>
  • To: discuss AT lists.opennicproject.org
  • Subject: Re: [opennic-discuss] The website
  • Date: Thu, 6 Dec 2012 19:47:20 -0600

On Thu, Dec 06, 2012 at 09:47:37PM +0000, Peter Green wrote:
> I would like to incorporate the 'nearest nameserver' feature into the
> demo site, the box top right of the home page on the wiki. Would the
> code for this be available anywhere? I have had a look around but
> can't see it. I'm guessing this code is the work of Brian or Jeff maybe.

You can't see it because it's an action on the wiki. Here's the
pertinent code:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"http://sourpuss.net/opennic.oss/geoip/geotxt3.php?ip=$ip".$res);
ob_start();
curl_exec($ch);
$res = ob_get_contents();
curl_close($ch);
ob_end_clean();
$results = array_filter(preg_split("/\s+/ ", $res));

$brk = '';
if($noformat == 0)
{
print "<br/>\n";
print "Closest Tier 2 servers to your location (ordered from nearest
to farthest):<br/>\n";
$brk = "<br/>";
}

foreach($results as $server)
{
print $server.$brk."\n";
}

--Brian


--
OpenNIC (the sequel) co-founder and wikimaster
IRC: Freenode.net channel #opennic



Archive powered by MHonArc 2.6.19.

Top of Page