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

Dir : /home/trave494/internetmoney.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/internetmoney.kerihosting.com/wp-content/plugins/wp-automatic/inc/class.pixabay.php

<?php

class pixabay {
	
	public $ch;
	public $api_key;
	
	function __construct($ch, $api_key){
		$this->ch = $ch;
		$this->api_key = $api_key;
	}
	
	function get_images($keyword , $page = 0) {
		 echo ' Finiding for: '. $keyword;
		 
		 $url = 'https://pixabay.com/api/?key='.$this->api_key.'&q=' . urlencode( trim( $keyword ) ) . '&image_type=photo&per_page=20' ; 
		 		
		 
		 		//pagination ?pagi=2
		 		if($page !== 0 ) $url.= '&page=' . trim($page);
		 
		 		echo '<br>Loading ' . $url ;
		 		
		 //curl get
		 $x='error';
		 curl_setopt($this->ch, CURLOPT_HTTPGET, 1);
		 curl_setopt($this->ch, CURLOPT_URL, trim($url));
		 $exec=curl_exec($this->ch);
		 $x=curl_error($this->ch);

		 if(trim($exec) == ''){
		 	echo '<-- Error: empty reply from PixaBay side ' . $x;
		 	return false;
		 }
		 
		 $json = json_decode($exec);
		
		 if(! isset($json->total)){
		 	echo '<-- Not expected output, JSON does not contain total number...' . $exec ;
		 	return false;
		 }else{
		 	echo '<br>PixaBay has '. $json->total. ' images for the keyword:'. $keyword;
		 }
		 
		   
		 return $json->hits;
		 
	}
}