<commit_before><?php
  
  ini_set('display_errors', 1);
  ini_set('display_startup_errors', 1);
  error_reporting(E_ALL);

  include './autoloader.php';

  use fp\result\ResFailure;
  use fp\result\ResSuccess;
  
  function curlJson(string $url, string $data){
      $ch = curl_init($url);
              
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type:application/x-www-form-urlencoded'));
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('data' => $data)));
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
              
      //execute post
      $res = curl_exec($ch);
      $error = curl_error($ch);
      curl_close($ch);
              
      if($error){
        return ResFailure::failure($error);
      } else {
        return ResSuccess::success($res);
      }
    }
    
    $data = json_encode(array('endpoint'=>'auth','endpointUrl'=>'http://localhost/microServicePHP/auth/'));
    
    echo curlJson('http://localhost/microServicePHP/router/?type=register', $data);
  <commit_msg>Added proper headers for json return<commit_after><?php
  
  ini_set('display_errors', 1);
  ini_set('display_startup_errors', 1);
  error_reporting(E_ALL);

  include './autoloader.php';

  use fp\result\ResFailure;
  use fp\result\ResSuccess;
  
  function curlJson(string $url, string $data){
      $ch = curl_init($url);
              
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type:application/x-www-form-urlencoded'));
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('data' => $data)));
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
              
      //execute post
      $res = curl_exec($ch);
      $error = curl_error($ch);
      curl_close($ch);
              
      if($error){
        return ResFailure::failure($error);
      } else {
        return ResSuccess::success($res);
      }
    }
    
    $data = json_encode(array('endpoint'=>'auth','endpointUrl'=>'http://localhost/microServicePHP/auth/'));
    
    header("Access-Control-Allow-Origin: *");
    header("Cache-Control: no-cache, must-revalidate");
    header("Content-type: application/json");
    echo curlJson('http://localhost/microServicePHP/router/?type=register', $data);
  
{'fraction_non_alphanumeric': 0.1536555142503098, 'fraction_numerical': 0.0024783147459727386, 'mean_word_length': 3.212173913043478, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1499585', 'n_tokens_mistral': 809, 'n_tokens_neox': 772, 'n_words': 117}