PHP 클래스 FoursquareApi

파일 보기 프로젝트 열기: hownowstephen/php-foursquare 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$LastUrl last url sent
$ResponseHeaders String[]

보호된 프로퍼티들

프로퍼티 타입 설명
$RedirectUri String

공개 메소드들

메소드 설명
AuthenticationLink ( String $redirect = '' ) AuthenticationLink Returns a link to the Foursquare web authentication page.
AuthorizeLink ( String $redirect = '' ) AuthorizeLink Returns a link to the Foursquare web authentication page. Using /authorize will ask the user to re-authenticate their identity and reauthorize your app while giving the user the option to login under a different account.
GeoLocate ( String $addr ) : array(lat, GeoLocate Leverages the google maps api to generate a lat/lng pair for a given address packaged with FoursquareApi to facilitate locality searches.
GetMulti ( Array $requests = false, boolean $POST = false ) GetMulti Performs a request for up to 5 private or public resources
GetPrivate ( String $endpoint, Array $params = false, boolean $POST = false ) GetPrivate Performs a request for a private resource
GetPublic ( String $endpoint, Array $params = false ) GetPublic Performs a request for a public resource
GetToken ( $code, $redirect = '' ) GetToken Performs a request to Foursquare for a user token, and returns the token, while also storing it locally for use in private requests
SetAccessToken ( String $token ) SetAccessToken Basic setter function, provides an authentication token to GetPrivate requests
__construct ( boolean | String $client_id = false, boolean | String $client_secret = false, string $redirect_uri = '', String $version = 'v2', string $language = 'en', string $api_version = DEFAULT_VERSION ) Constructor for the API Prepares the request URL and client api params
getResponseFromJsonString ( $json )
setRedirectUri ( $uri )

비공개 메소드들

메소드 설명
GET ( $url, $params = false ) GET Abstraction of the GET request
MakeUrl ( String $url, Array $params ) MakeUrl Takes a base url and an array of parameters and sanitizes the data, then creates a complete url with each parameter as a GET parameter in the URL
POST ( $url, $params = false ) POST Abstraction of a POST request
ParseHeaders ( $ch, $header ) : integer Callback function to handle header strings as they are returned by cUrl in the $this->Request() function Parses header strings into key/value pairs and stores them in $ResponseHeaders array
Request ( String $url, Array $params = false, $type = HTTP_GET ) Request Performs a cUrl request with a url generated by MakeUrl. The useragent of the request is hardcoded as the Google Chrome Browser agent

메소드 상세

GeoLocate() 공개 메소드

GeoLocate Leverages the google maps api to generate a lat/lng pair for a given address packaged with FoursquareApi to facilitate locality searches.
public GeoLocate ( String $addr ) : array(lat,
$addr String An address string accepted by the google maps api
리턴 array(lat,

GetMulti() 공개 메소드

GetMulti Performs a request for up to 5 private or public resources
public GetMulti ( Array $requests = false, boolean $POST = false )
$requests Array An array of arrays containing the endpoint and a set of parameters to be appended to the request, defaults to false (none)
$POST boolean whether or not to use a POST request, e.g. for large request bodies. It does not allow you to call endpoints that mutate data.

GetPrivate() 공개 메소드

GetPrivate Performs a request for a private resource
public GetPrivate ( String $endpoint, Array $params = false, boolean $POST = false )
$endpoint String A particular endpoint of the Foursquare API
$params Array A set of parameters to be appended to the request, defaults to false (none)
$POST boolean whether or not to use a POST request

GetPublic() 공개 메소드

GetPublic Performs a request for a public resource
public GetPublic ( String $endpoint, Array $params = false )
$endpoint String A particular endpoint of the Foursquare API
$params Array A set of parameters to be appended to the request, defaults to false (none)

GetToken() 공개 메소드

GetToken Performs a request to Foursquare for a user token, and returns the token, while also storing it locally for use in private requests
public GetToken ( $code, $redirect = '' )
$code The 'code' parameter provided by the Foursquare webauth callback redirect
$redirect The configured redirect_uri for the provided client credentials

SetAccessToken() 공개 메소드

SetAccessToken Basic setter function, provides an authentication token to GetPrivate requests
public SetAccessToken ( String $token )
$token String A Foursquare user auth_token

__construct() 공개 메소드

Constructor for the API Prepares the request URL and client api params
public __construct ( boolean | String $client_id = false, boolean | String $client_secret = false, string $redirect_uri = '', String $version = 'v2', string $language = 'en', string $api_version = DEFAULT_VERSION )
$client_id boolean | String
$client_secret boolean | String
$redirect_uri string
$version String Defaults to v2, appends into the API url
$language string
$api_version string https://developer.foursquare.com/overview/versioning

getResponseFromJsonString() 공개 메소드

public getResponseFromJsonString ( $json )

setRedirectUri() 공개 메소드

public setRedirectUri ( $uri )

프로퍼티 상세

$LastUrl 공개적으로 프로퍼티

last url sent
public $LastUrl

$RedirectUri 보호되어 있는 프로퍼티

protected String $RedirectUri
리턴 String

$ResponseHeaders 공개적으로 프로퍼티

public String[] $ResponseHeaders
리턴 String[]