ဗီဒီယိုပလက်ဖောင်းများမြင့်တက်လာခြင်းနှင့်အတူ Kaiishishou သည်လူကြိုက်များသောလူမှုရေးကိရိယာတစ်ခုဖြစ်လာသည်။ developer များအနေဖြင့်ကျွန်ုပ်တို့သည် PHP ကို အသုံးပြု. PHP ကို အသုံးပြု. အသုံးပြုသူအာရုံစူးစိုက်မှုနှင့်ပန်ကာစီမံခန့်ခွဲမှုဆိုင်ရာလုပ်ဆောင်မှုများကိုအလွယ်တကူအကောင်အထည်ဖော်ရန်အတွက် PHP ကိုသုံးနိုင်သည်။ ဤဆောင်းပါးသည် PHP နှင့်မည်သို့လုပ်ဆောင်ရမည်ကိုဖြတ်သန်းသွားပါမည်။
Kaiishishou အသုံးပြုသူအချက်အလက်များကို operating မလုပ်မီ, သင်သည်အသုံးပြုသူခွင့်ပြုချက်ကိုပထမ ဦး စွာရယူရမည်။ အသုံးပြုသူများသည် Thirbleisou အကောင့်ကို Oauth 2.0 ယန္တရားမှတဆင့်၎င်းတို့၏ Kairishou အကောင့်ကိုဝင်ရောက်ရန်တတိယပါတီလျှောက်လွှာများကိုခွင့်ပြုရန်လိုအပ်သည်။ အကောင်အထည်ဖော်မှုအဆင့်များမှာအောက်ပါအတိုင်းဖြစ်သည် -
ဤတွင်အခွင့်အာဏာစက်မှုနှင့်ဖုန်းနံပါတ်များကိုမည်သို့တည်ဆောက်ရမည်ကိုပြသသည့်နမူနာကုဒ်ဖြစ်သည်။
<?php $client_id = 'your_app_key'; $client_secret = 'your_app_secret'; $redirect_uri = 'your_callback_url'; // ခွင့်ပြုချက် link ကိုတည်ဆောက် $auth_url = 'https://open-api.kuaishou.com/oauth2/authorize?'; $auth_url .= 'client_id=' . $client_id; $auth_url .= '&response_type=code'; $auth_url .= '&redirect_uri=' . urlencode($redirect_uri); $auth_url .= '&scope=user_info,followers'; // callback အပြောင်းအလဲနဲ့ if (isset($_GET['code'])) { $code = $_GET['code']; // Access Token ကိုတောင်းဆိုပါ $token_url = 'https://open-api.kuaishou.com/oauth2/access_token?'; $token_url .= 'client_id=' . $client_id; $token_url .= '&client_secret=' . $client_secret; $token_url .= '&grant_type=authorization_code'; $token_url .= '&code=' . $code; $token_url .= '&redirect_uri=' . urlencode($redirect_uri); $response = file_get_contents($token_url); $result = json_decode($response, true); // Access Token ကိုသိမ်းပါ $access_token = $result['access_token']; // တိုကင်ကိုဒေတာဘေ့စ်သို့မဟုတ် cache ထဲတွင်သိုလှောင်ရန်အကြံပြုသည်,နောက်ဆက်တွဲမျက်နှာပြင်များခေါ်ဆိုရန်လွယ်ကူသည် } ?>
Kiishishou ၏ အသုံးပြုသူ / အောက်ပါ interface ကိုခေါ်ခြင်းအားဖြင့် developer များသတ်မှတ်ထားသောအသုံးပြုသူ၏အာရုံစူးစိုက်မှုကိုစာရင်းပြုစုနိုင်သည်။ တရားဝင်လက်လှမ်းမီမှုတိုကင်နှင့်အသုံးပြုသူ ID ကိုတောင်းဆိုစဉ်အတွင်းလွှဲပြောင်းရမည်။ နမူနာကုဒ်သည်အောက်ပါအတိုင်းဖြစ်သည် -
<?php $access_token = 'your_access_token'; $user_id = 'your_user_id'; $following_url = 'https://open-api.kuaishou.com/v1/user/following?'; $following_url .= 'access_token=' . $access_token; $following_url .= '&user_id=' . $user_id; $response = file_get_contents($following_url); $result = json_decode($response, true); // အာရုံစူးစိုက်မှုစာရင်းအချက်အလက်များကိုထုတ်ယူခြင်း // ... ?>
အလားတူစွာ, အသုံးပြုသူ / နောက်လိုက် interface ကိုအသုံးပြုသူပရိသတ်သတင်းအချက်အလက်ရရှိရန်ဟုခေါ်ဆိုနိုင်သည်။ အောက်ပါသည်ခေါ်ဆိုမှုဥပမာတစ်ခုဖြစ်သည်။
<?php $access_token = 'your_access_token'; $user_id = 'your_user_id'; $follower_url = 'https://open-api.kuaishou.com/v1/user/follower?'; $follower_url .= 'access_token=' . $access_token; $follower_url .= '&user_id=' . $user_id; $response = file_get_contents($follower_url); $result = json_decode($response, true); // ပန်ကာဒေတာကိုထုတ်ယူခြင်း // ... ?>
Oauth Authace နှင့်ဆက်စပ်သော interface call specs အပါအ 0 င် PHP မှအသုံးပြုသူအာရုံစူးစိုက်မှုနှင့်ပန်ကာစီမံခန့်ခွဲမှုများကိုအကောင်အထည်ဖော်ရန်အတွက်အဓိကဖြစ်စဉ်များကိုဤဆောင်းပါးသည်မိတ်ဆက်ပေးသည်။ developer များကဤအပေါ် မူတည်. ကြွယ်ဝသော Kaiishouou applications များသည် developes များဖြစ်ပေါ်နိုင်သည်။