Chinese Lunar Calendar

부분 유료
분류별 copy2sim | 업데이트됨 לפני חודשיים | Data
인기

8.4 / 10

지연 시간

450ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

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

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입