Thursday, 16 October 2014

FourSquare API integration with PHP website

Hi Friends Previously Explain about how to create Foursquare App, Now Explain Integrating Foursquare in Website using PHP with App Credentials Now, we will use a PHP library which is readily available here: Foursquare Libraries We will use the PHP one marked in red in below screenshot:

download the Zip Files and extract in this examples folder "tokenrequest.php" file is used to authenticated particular user. set your Client key and Secret, after getting the token it will redirect to "gettinguserdetails.php", in this file perform a request to getting user details find the following snippet of code
          $response = $foursquare->GetPrivate("users/self");
   $user_data = json_decode($response);
    echo 'Userid:'. $user_data->response->user->id';
    echo 'FirstName:'.$user_data->response->user->firstName;
    echo 'LastName:'.$user_data->response->user->lastName;
    echo 'Gender:'.$user_data->response->user->gender;
    echo 'Relationship:'.$user_data->response->user->relationship;
    echo 'HomeCity:'.$user_data->response->user->homeCity;
    echo 'Email:'.$user_data->response->user->contact->email;
    echo 'Facebook Id:'.$user_data->response->user->contact->facebook; 

For More Information You can Refer :

No comments:

Post a Comment