PHP code example of pixels / torn-api
1. Go to this page and download the library: Download pixels/torn-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pixels / torn-api example snippets
$masterApiKey = 'masterApiKey'; // Used as a fallback if no key is specified in a request
$selections = [\Torn\Services\UserService::BASIC];
$userId = 'someUserId';
$userApiKey = 'yourApiKey';
$useTornProxyByDefault = false;
$forceTornProxy = true; // Allows you to use Torn Proxy for a specific request
$httpClient = new GuzzleHttp\Client();
$client = new Torn\Client($httpClient, $masterApiKey, $useTornProxyByDefault);
$userService = new Torn\Services\UserService($client);
$user = $userService->fetch($userId, $selections, $userApiKey, $forceTornProxy);