private function http_post_data($url, $data_string, $authorization = null) {
$_ch = curl_init();
curl_setopt($_ch, CURLOPT_POST, 1);
curl_setopt($_ch, CURLOPT_URL, $url);
curl_setopt($_ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($_ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($data_string),
'Authorization:' . $authorization
)
);
ob_start();
curl_exec($_ch);
$return_content = ob_get_contents();
ob_end_clean();
return $return_content;
}
public function post($url, $data) {
$_data_string = json_encode($data);
$_ret = $this->http_post_data($url, $_data_string);
return json_decode($_ret);
}