Requesting User Info with Foursquare API

wuno

I am using the Foursquare API to request information for my users.

It says to make a request to get user info like this,

https://api.foursquare.com/v2/users/self?oauth_token=TOKENHERE

So I am doing it like this,

$fsUser = file_get_contents("https://api.foursquare.com/v2/users/self?oauth_token=".$access_token);

When I var_dump I get null from the value I am saving it in, Here is what my full code looks like,

<?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'];
}
?>

When I var_dump $fsUser I get bool(false)

I have var_dump every variable with no issues till I get to $fsUser I can not get past this part...

Zakir hussain

You also need to use the version number (v) with your request.

Like this

https://api.foursquare.com/v2/venues/search?client_id=CLIENT_ID&v=20140806&m=foursquare

See documentation here.

https://developer.foursquare.com/overview/versioning

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Foursquare API - Search By Address

From Dev

How To Get user birthday Info graph api

From Dev

Kong API Gateway session plugin with user info

From Dev

Ios - Twitter API getting user info issue

From Dev

How to get user info in PayPal REST API

From Dev

Searching Local Venues With Foursquare API

From Dev

Google Places and Foursquare iOS API

From Dev

Words with accents using FourSquare API

From Dev

phone number in json foursquare api

From Dev

Foursquare API - perform custom searches

From Dev

Foursquare API mayorships are always empty?

From Dev

Will new Foursquare changes (splitting Foursquare/Swarm) affect API?

From Dev

JQuery & Ajax - geonames autocomplete and requesting info fromfoursquare

From Dev

JQuery & Ajax - geonames autocomplete and requesting info fromfoursquare

From Dev

facebook api: does requesting publish_stream require confirmation from the user each time they login

From Dev

Requesting user input using JOptionPane

From Dev

CLLocationManager not requesting permission from user

From Dev

Requesting data about user iOS

From Dev

Get Photos and Detailed Info for Many Foursquare Venues in one call

From Dev

Get user info from Knackhq.com API with PHP

From Dev

What's the telegram API method to get "user is typing" info on a conversation?

From Dev

Get stream info of a user from Discord python API

From Dev

Unable to access user info object property - facebook chat api

From Dev

In SugarCRM API, how do I get a user's timezone info?

From Dev

Facebook Graph API: Retrieving User Friend's Info

From Dev

How get user info from twitter via API?

From Dev

How get user info from facebook via API?

From Dev

Get GitHub Rest API User info C# code

From Dev

where can be stored user info in .net core API project with angular

Related Related

  1. 1

    Foursquare API - Search By Address

  2. 2

    How To Get user birthday Info graph api

  3. 3

    Kong API Gateway session plugin with user info

  4. 4

    Ios - Twitter API getting user info issue

  5. 5

    How to get user info in PayPal REST API

  6. 6

    Searching Local Venues With Foursquare API

  7. 7

    Google Places and Foursquare iOS API

  8. 8

    Words with accents using FourSquare API

  9. 9

    phone number in json foursquare api

  10. 10

    Foursquare API - perform custom searches

  11. 11

    Foursquare API mayorships are always empty?

  12. 12

    Will new Foursquare changes (splitting Foursquare/Swarm) affect API?

  13. 13

    JQuery & Ajax - geonames autocomplete and requesting info fromfoursquare

  14. 14

    JQuery & Ajax - geonames autocomplete and requesting info fromfoursquare

  15. 15

    facebook api: does requesting publish_stream require confirmation from the user each time they login

  16. 16

    Requesting user input using JOptionPane

  17. 17

    CLLocationManager not requesting permission from user

  18. 18

    Requesting data about user iOS

  19. 19

    Get Photos and Detailed Info for Many Foursquare Venues in one call

  20. 20

    Get user info from Knackhq.com API with PHP

  21. 21

    What's the telegram API method to get "user is typing" info on a conversation?

  22. 22

    Get stream info of a user from Discord python API

  23. 23

    Unable to access user info object property - facebook chat api

  24. 24

    In SugarCRM API, how do I get a user's timezone info?

  25. 25

    Facebook Graph API: Retrieving User Friend's Info

  26. 26

    How get user info from twitter via API?

  27. 27

    How get user info from facebook via API?

  28. 28

    Get GitHub Rest API User info C# code

  29. 29

    where can be stored user info in .net core API project with angular

HotTag

Archive