Class GSRequest PHP

Skip to end of metadata
Go to start of metadata

 

Description

This class is used for sending a request to Gigya Service.

 

Constructor Summary

ConstructorDescription
GSRequest(string $apiKey,
                     string $secretKey,
                     string $apiMethod,
                     GSObject $params = null,
                     boolean $useHTTPS = false,
                     string $userKey = null)                    
Constructs a request using the following parameters:
  • apiKey - Your Gigya API-Key which can be obtained from the Dashboard section on Gigya's website (Read more in the Site Setup documentation).
  • secretKey - Your Gigya Secret-Key which can be obtained from the Dashboard section on Gigya's website (Read more in the Site Setup documentation).
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
  • params (optional) - A GSObject that contains the parameters for the Gigya API method to call. Please refer to the REST API reference and find in the specific method reference the list of method parameters.
  • useHTTPS (optional) - If you wish to send the request to Gigya using HTTPS, please set this parameter to TRUE. By default the request is sent using HTTP.
  • userKey (optional) - A key of an admin/application user with extra permissions. If this parameter is provided, then the secretKey parameter is assumed to be the admin user's secret key and not the site's secret key.

Note: you may pass an OAuth 2.0 access_token instead of passing APIKey+SecretKey. Pass the access_token as the first parameter (instead of APIKey) and null as the second (instead secretKey). Learn more about OAuth 2.0 and how to receive an access_token here.

  • accessToken - The access token that was earlier obtained in the login process.
  • apiMethod - The Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.

 

Method Summary

Method Description
static stringbuildQS(GSObject $params)Converts a GSObject to a query string.
GSObjectgetParams()Returns the 'params' field of the request.
GSResponse send(integer $timeout=null)Sends the request synchronously. The method returns a GSResponse object which represents Gigya's response. Parameter:
  • timeout (optional) - using this parameter you may set a timeout to this request. The timeout is the number of milliseconds till returning timeout response. If the timeout expires, the server will return a response with a "Request Timeout" error (error code 504002).
static voidsetCAFile(string $filename)Give Gigya the path to the CA file on your computer. Set the filename parameter with the full path to the CA file on your computer.
void setParam(string $param, mixed $val)Sets a request parameter with a value.
static stringUrlEncode(string $value)Applies URL encoding rules to the parameter string, and returns the outcome.
voidsetProxy(string $proxy,
   string $proxyUserPass=":",
   integer $proxyType=CURLPROXY_HTTP)
This method provides an option to specify a proxy, through which this request will be sent. Parameters: 
  • proxy (mandatory) - IP address of the proxy.
  • proxyUserPass (optional) - This parameter allows authentication via proxy. The format of this parameter is: "username:password".
  • proxyType (optional) - This parameter sets the proxy type on the cURL session. The parameter may receive one of the two constans: CURLPROXY_HTTP (default) or CURLPROXY_SOCKS5.
voidsetCurlOptionsArray(array $curlArray)This method enables setting multiple options for a cURL session, in addition to the option that is supported with the GSRequest.setProxy method. Parameter: 
  • curlArray (mandatory) - An array specifying which options to set and their values. The keys should be valid curl_setopt() constants or their integer equivalents. For example:

    $curlArray = array(CURLOPT_URL => 'http://www.example.com/', CURLOPT_HEADER => false);
voidsetAPIDomain(string $apiDomain)Sets the domain used for making API calls. This method provides the option to override the default domain "gigya.com" and specify an alternative data center to be used. Parameters: 
  • apiDomain (mandatory) - the domain of the data center to be used. For example: "eu1.gigya.com" for Europe data center or "au1.gigya.com" for Australia data center.

Clients with sites defined under Gigya's European data center should replace domain references to "us1.gigya.com" with "eu1.gigya.com". To verify site location see Finding Your Data Center.