API QIn 1.1
vam mIw QIn mIw app mIw yIlo', yIqaw 'ej Qapla' API yIlo'
App yIqel
App yIlo' API wIj, App yIqel App QaD. Qel App ID chenmoH 'ej mIw app tIq.
- puS App yIqel pat chu’ chenmoH
- App yIqel QaptaH, SoH DuQ yIHev app_id je app_secret
lo'laHmeH yI'el
Log In With mIw mach loDmey app yIqel 'ej mIw wejDu' mIw bImejnIS. Authentication 'ej SoQ qonwI' mIw yoDmey bImejnIS. Login With mIw Authentication pagh wejDu' mIw bImejnIS.
-
OAuth login mIw wIghuH, App yIqel 'ej chuq yIlo':
<a href="https://social.server-hssd.com/api/oauth?app_id=YOUR_APP_ID">Log in With LikViu</a>
lojmItvamvam vItlhutlh 'ej wejDIch ghoS 'e' yImev wej DIvI' logh
-
lojmItvam chonnaQ 'ej, wejDIch vIqawpu'bogh app Daq ghoS URL Hoch ghoS auth_key vamvam 'oH:
https://mydomain.com/my_redirect_url.php?auth_key=AUTH_KEY
vam auth_key wa'logh pagh usage 'oH, 'ej wa'logh lo'laHbe' 'e' yImev, 'ach DIvI' ghoS chenmoH 'e' yImev.
chenmoH pong
lojmItvam app SIQpu'bogh 'ej logh ghoS wIghaj 'ej chu'wI' Daq auth_key vaj DaH jIyIn API pagh Qul, 'ej wIj app approve 'ej chu'wI' Qul access_token vaj Suq DuHmey, tlhutlhmoH Qulmo'.
-
wIj access token ghoS HTTP GET ghotpu'vamvam:
<?php $app_id = "YOUR_APP_ID"; // your app id $app_secret = "YOUR_APP_SECRET"; // your app secret $auth_key = $_GET['auth_key']; // the returned auth key from previous step // Prepare the POST data $postData = [ 'app_id' => $app_id, 'app_secret' => $app_secret, 'auth_key' => $auth_key ]; // Initialize cURL $ch = curl_init('https://social.server-hssd.com/api/authorize'); // Set cURL options for POST curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData)); // Execute request $response = curl_exec($ch); // Check for cURL errors if (curl_errno($ch)) { die('cURL error: ' . curl_error($ch)); } curl_close($ch); // Decode the JSON response $json = json_decode($response, true); // Use the access token if available if (!empty($json['access_token'])) { $access_token = $json['access_token']; // your access token } ?>vam access_token wa' rep vItlhutlh 'oH, 'ach rep wa'DIch vItlhutlhbe' vaj DIvI' ghoS chenmoH.
naw’meH patmey
vaj wIghaj access_token DaH jIyIn HTTP GET ghotpu' 'ej parameters qon
| QonoS ghoS | lut |
|---|---|
| api/get_user_info |
lojmIt mIw Qul |
vamvam lojmIt Qulmo'
if(!empty($json['access_token'])) {
$access_token = $json['access_token']; // your access token
$get = file_get_contents("https://social.server-hssd.com/api/get_user_info?access_token=$access_token");
}
Hoch vItlhutlh:
{
"user_info": {
"user_id": "",
"user_name": "",
"user_email": "",
"user_firstname": "",
"user_lastname": "",
"user_gender": "",
"user_birthdate": "",
"user_picture": "",
"user_cover": "",
"user_registered": "",
"user_verified": "",
"user_relationship": "",
"user_biography": "",
"user_website": ""
}
}