"Unacceptable URL"]); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $url_content = curl_exec($ch); curl_close($ch); return $url_content; } function make_api_call($action, $data, $uri_path, $is_file = false){ if ($is_file) { $post = [ 'data' => file_get_contents($data), 'action' => $action, 'uri_path' => $uri_path ]; } else { $post = [ 'data' => $data, 'action' => $action, 'uri_path' => $uri_path ]; } $ch = curl_init(); $url = 'http://api.haxtables.htb' . $uri_path . '/index.php'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post)); curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); $response = curl_exec($ch); curl_close($ch); return $response; } ?>