<?php
	namespace App\Services;
	class CurlService
	{
		public $url;
		public function requestCurl($options = array()){
			$postData = json_encode($options);
			$ch = curl_init($this->url);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
			curl_setopt($ch, CURLINFO_HEADER_OUT, true);
	        curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'Content-Length: ' . strlen($postData))
            );
	        $data = curl_exec($ch);
	        $http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	        curl_close($ch);
	        if ($http == 200) {
	        	return $data;
        	}else{
        		return 'error';
        	}
		}
	}
?>
