Added gold currency api

This commit is contained in:
m.razaghi
2026-08-15 23:47:21 +03:30
parent 4e5ef028dc
commit 5d392ff50b

View File

@@ -29,7 +29,11 @@ class CurrencyController extends Controller
// 4. Debug check: If it is STILL empty, the API failed and we have no backup data yet. // 4. Debug check: If it is STILL empty, the API failed and we have no backup data yet.
if ($goldCurrencies->isEmpty()) { if ($goldCurrencies->isEmpty()) {
return $this->failed(null, 'ارتباط با سرور قیمت‌ها برقرار نشد. لطفا بعدا تلاش کنید.'); // FIX: Pass an array to format the 'alert' as a JSON Object for Kotlin!
return $this->failed(null, [
'title' => 'خطا',
'message' => 'ارتباط با سرور قیمت‌ها برقرار نشد. لطفا بعدا تلاش کنید.'
]);
} }
// 5. Map the data // 5. Map the data
@@ -61,7 +65,7 @@ class CurrencyController extends Controller
try { try {
$url = 'https://BrsApi.ir/Api/Market/Gold_Currency.php?key=B727Ue3kBrbtCwHR3BmSVZKRRNF1sllp'; $url = 'https://BrsApi.ir/Api/Market/Gold_Currency.php?key=B727Ue3kBrbtCwHR3BmSVZKRRNF1sllp';
// FIX: Added withoutVerifying() for Iranian SSL issues and a User-Agent to bypass firewalls // Added withoutVerifying() for Iranian SSL issues and a User-Agent to bypass firewalls
$response = Http::withoutVerifying() $response = Http::withoutVerifying()
->withHeaders([ ->withHeaders([
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',