1
Foursquare API
을 사용하여 사용자 정보를 요청합니다.Foursquare API로 사용자 정보 요청
https://api.foursquare.com/v2/users/self?oauth_token=TOKENHERE
그래서 내가 이런 식으로 일을하고 그것은이 같은 사용자 정보를 얻을 수있는 요청을 말한다
, 나는 내가 값에서 널 얻기 위해서 var_dump
$fsUser = file_get_contents("https://api.foursquare.com/v2/users/self?oauth_token=".$access_token);
내가
var_dump $fsUser
내가를 얻을 때 그것을 저장, 여기, 내 전체 코드가 어떻게 생겼는지
<?php
$client_id = "iwdhwouchweohcuwoehcowehcu";
$secret = "ojdwojwjwrhvo";
$redirect = "http://www.example.com";
if($_GET['code']){
//We need to hit up the authkey URL and get the key in JSON format
$authkey = file_get_contents("https://foursquare.com/oauth2/access_token?client_id=".$client_id."&client_secret=".$secret."&grant_type=authorization_code&redirect_uri=".$redirect."&code=".$_GET['code']);
//We then need to decode it and store that key in a variable
$auth = json_decode($authkey,true);
$access_token = $auth['access_token'];
//we then look up whatever endpoint of the api we want
$fsUser = file_get_contents("https://api.foursquare.com/v2/users/self?oauth_token=".$access_token);
$user = json_decode($fsUser, true);
// $name = $decoded_userinfo['response']['user']['firstName'];
}
?>
입니다
나는 또한 (V) 귀하의 요청에 버전 번호를 사용할 필요가 나는이 부분 번번이 수 $fsUser
에 얻을 때까지 문제없이 모든 변수 ...