Chinese Lunar Calendar

FREEMIUM
Par copy2sim | Mise à jour 2ヶ月前 | Data
Popularité

8.5 / 10

Latence

439ms

Niveau de service

100%

Health Check

N/A

Retour à toutes les discussions

Not JSON style

Rapid account: Dodopianist
dodopianist
1年前

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 1年前

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 1年前

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 1年前

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 1年前

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

Participez à la discussion - ajoutez un commentaire ci-dessous:

Connectez-vous / Inscrivez-vous pour publier de nouveaux commentaires