Chinese Lunar Calendar

免费增值
通过 copy2sim | 已更新 hace 2 meses | Data
人气

8.5 / 10

延迟

439ms

服务等级

100%

Health Check

N/A

返回所有讨论

Not JSON style

Rapid account: Dodopianist
dodopianist
hace un año

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 hace un año

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 hace un año

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 hace un año

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 hace un año

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

加入讨论 - 在下面添加评论:

登录/注册以发布新的评论