Skip to content

Instantly share code, notes, and snippets.

@back2arie
Created October 15, 2012 17:14
Show Gist options
  • Save back2arie/3893709 to your computer and use it in GitHub Desktop.
Save back2arie/3893709 to your computer and use it in GitHub Desktop.
DNS over HTTP
<?php
$ch = curl_init('http://49.50.8.82/phpjsondns/api.github.com/a');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: azhari.harahap.us"));
$content = curl_exec($ch);
$content = json_decode($content, TRUE);
curl_close($ch);
$github = $content['result'][0]['ip'];
$ch = curl_init('https://'.$github.'/legacy/repos/search/:php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: api.github.com"));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); # ignore SSL check
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); # ignore SSL check
$content = curl_exec($ch);
$content = json_decode($content, TRUE);
echo "<pre>";
print_r($content);
echo "</pre>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment