| Server IP : 5.129.245.98 / Your IP : 216.73.217.19 Web Server : Apache/2.4.66 (Debian) System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/content-egg/application/libs/viglink/ |
Upload File : |
<?php
namespace ContentEgg\application\libs\viglink;
defined('\ABSPATH') || exit;
use ContentEgg\application\libs\RestClient;
/**
* ViglinkApi class file
*
* @author keywordrush.com <support@keywordrush.com>
* @link https://www.keywordrush.com
* @copyright Copyright © 2025 keywordrush.com
*
* @link: https://developer.sovrn.com/reference/product-affiliate-api
*
*/
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'RestClient.php';
class ViglinkApi extends RestClient
{
protected static $timeout = 40; //sec
const API_URI_BASE = 'https://comparisons.sovrn.com/api/affiliate/v3.5/sites/{site-api-key}/compare/prices/{market}';
protected $apiKey;
protected $secretKey;
protected $market;
protected $_responseTypes = array(
'json',
);
public function __construct($apiKey, $secretKey, $market, $response_type = 'json')
{
$this->apiKey = $apiKey;
$this->secretKey = $secretKey;
$this->market = $market;
$this->setResponseType($response_type);
$url = self::API_URI_BASE;
$url = str_replace('{site-api-key}', urlencode($this->apiKey), $url);
$url = str_replace('{market}', urlencode($this->market), $url);
$this->setUri($url);
}
/**
* Product Search
* @link: https://developer.sovrn.com/reference/product-affiliate-api
*/
public function search(array $options)
{
$response = $this->restGet('/by/accuracy', $options);
return $this->_decodeResponse($response);
}
public function restGet($path, array $query = null)
{
$this->setCustomHeaders(array('Authorization' => 'secret ' . $this->secretKey));
return parent::restGet($path, $query);
}
}