-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_api_check.php
More file actions
88 lines (72 loc) · 2.5 KB
/
simple_api_check.php
File metadata and controls
88 lines (72 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo "<h2>Simple API Check</h2>";
echo "<pre>";
echo "Step 1: Testing API connection...\n";
$apiUrl = 'https://eunixma.com.ng/api/ads/51';
echo "Fetching: {$apiUrl}\n\n";
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
$response = @file_get_contents($apiUrl, false, $context);
if ($response === false) {
echo "❌ Failed to fetch API\n";
$error = error_get_last();
echo "Error: " . ($error['message'] ?? 'Unknown error') . "\n";
} else {
echo "✅ API response received\n\n";
$data = json_decode($response, true);
if ($data) {
echo "Step 2: Checking image URLs...\n";
echo "==========================================\n\n";
echo "preview_image field:\n";
if (isset($data['preview_image'])) {
echo $data['preview_image'] . "\n\n";
// Check if contains localhost
if (strpos($data['preview_image'], 'localhost') !== false) {
echo "❌ Still using localhost!\n\n";
} elseif (strpos($data['preview_image'], 'eunixma.com.ng') !== false) {
echo "✅ Using correct domain!\n\n";
} else {
echo "⚠️ Using different domain\n\n";
}
} else {
echo "❌ No preview_image field\n\n";
}
echo "images array:\n";
if (isset($data['images']) && is_array($data['images'])) {
echo "Found " . count($data['images']) . " images:\n";
foreach ($data['images'] as $img) {
echo " - " . $img['image_path'] . "\n";
}
} else {
echo "❌ No images array\n";
}
} else {
echo "❌ Failed to parse JSON\n";
echo "Response: " . substr($response, 0, 500) . "\n";
}
}
echo "\n==========================================\n";
echo "Step 3: Test direct image access...\n";
echo "==========================================\n\n";
$testImageUrl = 'https://eunixma.com.ng/storage/ads/1765552635_693c31fb78d01.jpg';
echo "Testing: {$testImageUrl}\n";
$headers = @get_headers($testImageUrl);
if ($headers) {
echo "Response: {$headers[0]}\n";
if (strpos($headers[0], '200') !== false) {
echo "✅ Image accessible!\n";
} else {
echo "❌ Image not accessible!\n";
}
} else {
echo "❌ Could not check image\n";
}
echo "\n</pre>";
echo "<p><strong>DELETE THIS FILE!</strong></p>";
?>