Initial commit BIJ CI4
This commit is contained in:
38
public/ios/app/debug/simple_berita_debug.php
Normal file
38
public/ios/app/debug/simple_berita_debug.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../config.php';
|
||||
|
||||
$token = $_SESSION['token'] ?? null;
|
||||
if (!$token) {
|
||||
echo "No token found";
|
||||
exit;
|
||||
}
|
||||
|
||||
$berita_result = api_get_berita($token);
|
||||
echo "<h2>Simple Berita Debug</h2>";
|
||||
|
||||
if ($berita_result['success']) {
|
||||
$data = $berita_result['data'];
|
||||
echo "<h3>Raw Data Structure:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($data);
|
||||
echo "</pre>";
|
||||
|
||||
$items = $data['data'] ?? $data;
|
||||
if (is_array($items)) {
|
||||
echo "<h3>Items Count: " . count($items) . "</h3>";
|
||||
echo "<h3>First Item:</h3>";
|
||||
echo "<pre>";
|
||||
print_r($items[0] ?? 'No first item');
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h3>All Items with IDs:</h3>";
|
||||
foreach ($items as $i => $item) {
|
||||
$id = $item['id'] ?? $item['berita_id'] ?? "NO_ID_$i";
|
||||
$judul = $item['judul'] ?? 'NO_TITLE';
|
||||
echo "<p>$i: ID='$id', Judul='$judul'</p>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p>Error: " . ($berita_result['data']['pesan'] ?? 'Unknown error') . "</p>";
|
||||
}
|
||||
Reference in New Issue
Block a user