public static function docurl($url, $json, $post = true) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $res = curl_exec($ch); curl_close($ch); return json_decode($res, true); }