+91 98305-22543      Kona Expressway, Howrah       [email protected]

Panchang cURL example

Panchang cURL example

Following PHP cURL code can be used to connect and get the response of Panchang API.

<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_URL => "https://panchang2.p.rapidapi.com/",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_ENCODING => "",
	CURLOPT_MAXREDIRS => 10,
	CURLOPT_TIMEOUT => 30,
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	CURLOPT_CUSTOMREQUEST => "POST",
	CURLOPT_POSTFIELDS => "panchangdate=15-02-2024&panchangtime=15%3A44&panchanglongitude=77.21&panchanglatitude=28.61&panchangtimezone=5.5",
	CURLOPT_HTTPHEADER => [
		"X-RapidAPI-Host: panchang2.p.rapidapi.com",
		"X-RapidAPI-Key: YOUR_RAPIDAPI_KEY",
		"content-type: application/x-www-form-urlencoded"
	],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
	echo "cURL Error #:" . $err;
} else {
	echo $response;
}
Panchang cURL example

Powered by BetterDocs

Scroll to top