public function json_api_call($template) { $instance = new self(); if (filter_var($template, FILTER_VALIDATE_URL)) { $service_url = $template; $curl = curl_init($service_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); // curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data); $curl_response = curl_exec($curl); // echo $curl_response; $template = $curl_response; if ($instance->isJson($template)) { curl_close($curl); return $template; } return false; } else { return false; } }