forked from harshasoftware/flipside.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflipsidexmlclient.php
More file actions
55 lines (42 loc) · 1.76 KB
/
flipsidexmlclient.php
File metadata and controls
55 lines (42 loc) · 1.76 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
<?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 FlipsideXMLClient extends FlipsideIO
{
// protected $responseType;
//XML Client Constructor
public function __construct($fkAffiliateId, $fkAffiliateToken)
{
$this->fkAffiliateToken = $fkAffiliateId;
$this->fkAffiliateToken = $fkAffiliateToken;
//Add the affiliateId and response_type to the base URL to complete it.
$this->apiRequestUrl.=$this->apiBaseUrl.'.'.$this->affiliateId.'.xml';
$this->client = new Client();
}
//Make Request to API
function makeRequest(){
$request = $this->client->createRequest('GET', $this->apiRequestUrl);
$request->setHeader('Content-Type', 'application/xml');
//$request->setHeader('Cache-Control: no-cache');
$request->setHeader('Fk-Affiliate-Id',$this->fkAffiliateToken);
$request->setHeader('Fk-Affiliate-Token',$this->fkAffiliateToken);
$response = $this->client->send($request);
$responseCode = $response->getStatusCode();
if(($responseCode==410)||($responseCode==403)||($responseCode==401)){
returnApiError();
}
//echo $response->xml();
print_r($response->xml());
}
}//End Of Class
?>