<?php 
	class Calendarista_NewAppointmentRestHandler
	{
		public function __construct($args){
			
		}
		public function postDataToUrl($url, $data){
			if(!$data || !is_array($data)){
				return;
			}
			$postdata = json_encode($data);
			$ch = curl_init($url);
			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
			curl_setopt($ch, CURLOPT_POST, 1);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
			curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
			if(!$result = curl_exec($ch))
			{
				$message = curl_error($ch);
				Calendarista_ErrorLogHelper::insert($message);
			}
			curl_close($ch);
		}
	}
?>
