PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/demo2024feb.kerihosting.com/wp-content/plugins/wp-automatic/inc/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/demo2024feb.kerihosting.com/wp-content/plugins/wp-automatic/inc/class.walmart.php

<?php

class wpAutomaticWallMart{
	
	public $ch; // curl handle
	public $apiKey; // api key
	public $lsPublisherId; // published ID
	
	function __construct(&$ch,$apiKey,$lsPublisherId = ''){
		
		$this->ch = $ch;
		$this->apiKey = $apiKey;
		
		if(trim($lsPublisherId) == '') $lsPublisherId = 1804192 ;
		
		$this->lsPublisherId = $lsPublisherId;
		
	}
	
	function getItemsByKeyword($keyword,$parms=array(),$start=0){
		
		//http://api.walmartlabs.com/v1/search?apiKey={apiKey}&lsPublisherId={Your LinkShare Publisher Id}&query=ipod

		// Encoded keyword
		$keywordEnc= urlencode( trim($keyword) );
		
		// Search URL 
		$wallMartUrl = "http://api.walmartlabs.com/v1/search?apiKey={$this->apiKey}&publisherId={$this->lsPublisherId}&query=$keywordEnc&responseGroup=full";
		
		// Additional Parms
		foreach ($parms as $key=>$value){
			
			$wallMartUrl.= '&'.trim($key) .'='.trim (urlencode($value));
			
		}
		
		  echo '<br>'.str_replace($this->apiKey, '[key]', $wallMartUrl) ;
		
		// Execute
		$x='error';
		curl_setopt($this->ch, CURLOPT_HTTPGET, 1);
		curl_setopt($this->ch, CURLOPT_URL, trim($wallMartUrl));
		$exec=curl_exec($this->ch);
		$x=curl_error($this->ch);
		
		//validate reply
		if(trim($exec) == ''){
			throw new Exception('Empty response from Walmart with possible curl error '.$x);
		}
		
		return $this->parseResult($exec);
		
	}
	
	function getItemByUPC(){
		
	}
	
	function parseResult($exec){
		
		//validate Json		
		if(!stristr($exec, '{')){
			throw new Exception('Not Json reply from walmart: '.$exec);
		}
		
		//Json decode
		$json = json_decode($exec);
		
		//return
		return $json->items;
		
	}
	
}