Chinese Lunar Calendar

FREEMIUM
Door copy2sim | Bijgewerkt 2 महीने पहले | Data
Populariteit

8.6 / 10

Latency

437ms

Serviceniveau

100%

Health Check

N/A

Terug naar alle discussies

Not JSON style

Rapid account: Dodopianist
dodopianist
एक वर्ष पहले

Hello!

The value in the “result” key is not in the proper JSON style, so it is hard to access the needed value. Could you help fix it?

Result

Thank you very much!!

Rapid account: Copy 2 Sim
copy2sim Commented एक वर्ष पहले

I don’t see your attachment. Anyway, here are the source code for python & js. Hope that helps.

Python:
https://drive.google.com/file/d/1P850m2IsemJw-YnTWxUA59Y86MQY965K/view?usp=sharing
Js:
https://drive.google.com/file/d/1CenagktVjnX69cJmdiVGxTc1-Hrduc2K/view?usp=sharing

Rapid account: Dodopianist
dodopianist Commented एक वर्ष पहले

Thanks!

I use JavaScript and Python to access your api.

I have noticed that the result is a string and managed to extract information using regex. However, if you also have solutions for the languages I am using I would be happy to know. Thanks in advanced!!

p.s. the screenshot is when I accessed your api using Python.

Rapid account: Copy 2 Sim
copy2sim Commented एक वर्ष पहले

Don’t know why my code turns into something unreadable, I uploaded it to GDrive in a txt file: https://drive.google.com/file/d/1c2XQVWKRe9ohQ5uuoqMmJ7iTD9RGD3VA/view?usp=sharing

Rapid account: Copy 2 Sim
copy2sim Commented एक वर्ष पहले

Hi,

The value of the result part is a string which I convert from a json object. If you copy the string and check, you will find it is a valid json string.

Here’s a piece of PHP code I wrote which might help you understand how to interpret the result(replace x-rapid-key with your own one):

url=https://chineselunarcalendar.p.rapidapi.com/?date=20230124;url = 'https://chinese-lunar-calendar.p.rapidapi.com/?date=20230124'; ch = curl_init($url);

headers=[XRapidAPIKey:00000000000000,XRapidAPIHost:chineselunarcalendar.p.rapidapi.com];curlsetopt(headers = [ 'X-RapidAPI-Key: 00000000000000', 'X-RapidAPI-Host: chinese-lunar-calendar.p.rapidapi.com' ]; curl_setopt(ch, CURLOPT_HTTPHEADER, headers);curlsetopt(headers); curl_setopt(ch, CURLOPT_POST, 0);
curl_setopt(ch,CURLOPTRETURNTRANSFER,true);ch, CURLOPT_RETURNTRANSFER, true); response = curl_exec(ch);curlclose(ch); curl_close(ch);

responseinjson=jsondecode(responseinjson = json_decode(response);
result=jsondecode(result = json_decode(responseinjson->result);
var_dump($result->lunarDateinChinese);

Please let me know if that answers your question. If you use other programming languages, please tell me so I can check as well. Cheers

Doe mee aan de discussie - voeg hieronder een opmerking toe

Log in / Schrij u in om nieuwe opmerkingen te plaatsen