Skip to content

Instantly share code, notes, and snippets.

@shanecp
Created April 9, 2018 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shanecp/a28d802f7443038ea099bbdcbd56b8cd to your computer and use it in GitHub Desktop.
Save shanecp/a28d802f7443038ea099bbdcbd56b8cd to your computer and use it in GitHub Desktop.
DomDetailer PHP Code
<?php
$results = [];
if (!empty($_POST['domains'])) {
$apiKey = 'INSERT_API_KEY';
$domains = explode("\n", $_POST['domains']);
foreach ($domains as $domain) {
$domain = trim($domain);
if (empty($domain)) continue;
$apiEndpoint = "http://domdetailer.com/api/checkDomain.php?domain={$domain}&app=DomDetailer&apikey={$apiKey}&majesticChoice=root";
// create curl resource
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiEndpoint);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
if (!empty($output)) {
$result = json_decode($output, true);
$results[$domain] = $result;
}
// close curl resource to free up system resources
curl_close($ch);
}
}
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Check Moz Details</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<form action="check.php" method="post">
<textarea name="domains" id="" cols="50" rows="20"></textarea>
<br>
<button class="btn btn-success">Submit</button>
</form>
<hr>
<table class="table table-bordered">
<thead>
<tr>
<th>domain</th>
<th>mozLinks</th>
<th>mozPA</th>
<th>mozDA</th>
<th>mozRank</th>
<th>mozTrust</th>
<th>majesticLinks</th>
<th>
majesticRefDomains <br>
Referring domains
</th>
<th>
majesticCF <br>
Citation Flow
</th>
<th>
majesticTF <br>
Trust Flow
</th>
<th>FB_comments</th>
<th>FB_shares</th>
<th>pinterest_pins</th>
<!-- <th>linkedin</th> -->
<th>stumbles</th>
</tr>
</thead>
<tbody>
<?php foreach ($results as $domain => $values): ?>
<tr>
<td><?php echo $values['domain'] ?></td>
<td><?php echo $values['mozLinks'] ?></td>
<td><?php echo $values['mozPA'] ?></td>
<td><?php echo $values['mozDA'] ?></td>
<td><?php echo $values['mozRank'] ?></td>
<td><?php echo $values['mozTrust'] ?></td>
<td><?php echo $values['majesticLinks'] ?></td>
<td><?php echo $values['majesticRefDomains'] ?></td>
<td><?php echo $values['majesticCF'] ?></td>
<td><?php echo $values['majesticTF'] ?></td>
<td><?php echo $values['FB_comments'] ?></td>
<td><?php echo $values['FB_shares'] ?></td>
<td><?php echo $values['pinterest_pins'] ?></td>
<!-- <td><?php echo $values['linkedin'] ?></td> -->
<td><?php echo $values['stumbles'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment