Eurica!

numbers for the people.

Oh ARIN, using HTTP headers?

| 0 comments

For urlminder.appspot.com, I want to integrate the ownership information on a particular netblock that ARIN provides through their REST interface but it was returning HTML despite my clever guess that adding “?format=json” would change the format.

It turns out that ARIN actually reads the HTTP Accept header so to get your formatted response you need to actually construct your request:

<?php
$opts = array(
  'http'=>array(
    'header'=>"Accept: application/json"
  )
);
$context = stream_context_create($opts);
$fp = fopen('http://whois.arin.net/rest/ip/74.125.95.141', 'r', false, $context);
fpassthru($fp);
fclose($fp);
?>

(The actual code on urlminder.appspot.com is Python)

be a pal and share this would ya?
Oh ARIN, using HTTP headers?
Web Statistics