forked from harshasoftware/flipside.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflipsidejsonclient.php
More file actions
58 lines (42 loc) · 1.6 KB
/
flipsidejsonclient.php
File metadata and controls
58 lines (42 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* PHP Client for Flipkart Affilate API-[FLIPSIDE.IO]
* GitHub: https://github.com/sriharrsha/flipside.io
* License: MIT License
*
* @author Sri Harrsha <harrshasri@gmail.com>
* @version 0.1
*/
namespace developerowl;
chdir(dirname(__DIR__));
require 'vendor/autoload.php';
use GuzzleHttp\Client as Client;
class FlipsideJSONClient extends FlipsideIO {
//JSON Client Constructor
public function __construct($fkAffiliateId, $fkAffiliateToken) {
// super($fkAffiliateId,$fkAffiliateToken);
// Add the affiliateId and response_type to the base URL to complete it.
$this->fkAffiliateId = $fkAffiliateId;
$this->fkAffiliateToken = $fkAffiliateToken;
$this->apiRequestUrl.=$this->apiBaseUrl.$this->fkAffiliateId.'.json';
$this->client = new Client();
}
//Make Request to API
function makeRequest() {
$request = $this->client->createRequest('GET', $this->apiRequestUrl);
$request->setHeader('Content-Type', 'application/json');
// $request->setHeader('Cache-Control: no-cache');
$request->setHeader('Fk-Affiliate-Id', $this->fkAffiliateId);
$request->setHeader('Fk-Affiliate-Token', $this->fkAffiliateToken);
$response = $this->client->send($request);
$responseCode = $response->getStatusCode();
if (($responseCode == 410) || ($responseCode == 403) || ($responseCode == 401)) {
returnApiError();
}
//echo "Harrsha";
//echo $response->json();
print_r($response->json());
}
}
//End Of Class
?>