Zurück zu allen Diskussionen
i want to use this api
waseemtunio
5 years ago
can you hep how to use this api through curl use in php . i am using this type of code but something wrong because api did not show any result
$url = “https://aladhan.p.mashape.com/timingsByCity?city=karachi&country=pakistan”;
// request timeout in seconds
$timeout = 10;
// Custom headers. X-Mashape-Key is mandatory, you can add more if you want
$headers = array(
“X-Mashape-Key: tOIEHtjceZmshwh6kmt62lH3P0gNp1RVL6ojsnP5oRUekQ027q”,
“Accept: application/json”
);
// Request Type: GET | POST | PUT | PATCH | DELETE
//$method = 'GET';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers );
//curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:
Anmelden / Registrieren, um neue Kommentare zu veröffentlichen
because (https://aladhan.com/prayer-times-api) that api does not show prefect result based on city like karachi
Is there a reason why you are not using Guzzle for PHP or the AlAdhan PHP API Client (https://github.com/islamic-network/aladhan-api-client-php)?