Init import
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<pre><?php
|
||||
require('config.php');
|
||||
|
||||
$rows = [];
|
||||
$ch = curl_init($cfg['API_ENDPOINT_REDIRECTS']);
|
||||
|
||||
// Set curl options
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_FAILONERROR => true,
|
||||
CURLOPT_FOLLOWLOCATION => false,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'X-API-Key: ' . $cfg['API_KEY'],
|
||||
'accept: application/json',
|
||||
],
|
||||
]);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
if (!curl_errno($ch) && curl_getinfo($ch)['http_code'] === 200) {
|
||||
$rows = json_decode($response);
|
||||
} else {
|
||||
var_dump(curl_getinfo($ch)['http_code']);
|
||||
var_dump(curl_error($ch));
|
||||
}
|
||||
curl_close($ch);
|
||||
?>
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Entry Source</th><th>Redirect to</th><th>Append</th><th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($rows as $row) {
|
||||
$row->safe_append = htmlentities($row->append);
|
||||
echo "<tr>\n";
|
||||
echo "<td><a target=\"_blank\" href=\"https://{$row->src}\">{$row->src}</a></td>";
|
||||
echo "<td>{$row->site}</td>";
|
||||
echo "<td>{$row->safe_append}</td>";
|
||||
echo "<td><button name=\"delete\" data-id=\"{$row->_id}\">🚮</button><button name=\"edit\" data-id=\"{$row->_id}\">✎</button></td>";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="btn btn-primary" href="add-site.php">Add another one</a>
|
||||
Reference in New Issue
Block a user