Wallogit.com
2017 © Pedro Peláez
PHP sdk for replacing affiliate links
``` sh $ composer require ivanhoe/ivanhoe-sdk, (*1)
## Basic Usage ### Create a user session and get sub id ----------- ``` php $httpClient = new \Ivanhoe\SDK\CurlClient(); $sessionResource = new Ivanhoe\SDK\SessionResource($httpClient); $subId = $sessionResource->setCredentials(['id', 'password']) ->getSubId();
This method will send user data to Ivanhoe server and return a generated sub id. But you can pass custom body parameters to SessionResource::getSubId to override user info., (*2)
hostname - Your website hostname with a protocol., (*3)
user_agent - Valid user agent., (*4)
user_ip - Valid ipv4 or ipv6., (*5)
referrer - The traffic source., (*6)
document_path., (*7)
language - Two characters that means a user language., (*8)
google_client_id - Google analytics client id from [_ga] cookie. Can be get within a helper Analitycs, (*9)
Example:, (*10)
``` php $httpClient = new \Ivanhoe\SDK\CurlClient(); $sessionResource = new Ivanhoe\SDK\SessionResource($httpClient);, (*11)
$subId = $sessionResource->setCredentials(['id', 'password']) ->getSubId([ 'hostname' => 'http://test.com', // google analytics profile id // https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id 'google_client_id' => Ivanhoe\SDK\Analytics::getProfileId(), ]);, (*12)
### Setting options You are able to set curl options on CurlClient::setOpts method. The keys are curl option constants. ----------- ``` php $httpClient = new \Ivanhoe\SDK\CurlClient(); $httpClient->setOpts([ CURLOPT_FRESH_CONNECT => true ]);