public static function curl(string $url, array $param = null, array $options = ['post' => 1]){
    $ch = curl_init();
    self::$last_curl = $ch;
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if (\is_object($param) ){
      $param = self::to_array($param);
    }
    if ( \defined('BBN_IS_SSL') && \defined('BBN_IS_DEV') && BBN_IS_SSL && BBN_IS_DEV ){
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      //curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
    }
    $options = array_change_key_case($options, CASE_UPPER);
    foreach ( $options as $opt => $val ){
      if ( \defined('CURLOPT_'.$opt) ){
        curl_setopt($ch, constant('CURLOPT_'.$opt), $val);
      }
    }
    if ( $param ){
      if ( !empty($options['POST']) ){
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
      }
      else if ( !empty($options['DELETE']) ){
        //die($url.'?'.http_build_query($param));
        curl_setopt($ch, CURLOPT_URL, $url.'?'.http_build_query($param));
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');        
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      }
      else{
        curl_setopt($ch, CURLOPT_URL, $url.'?'.http_build_query($param));
      }
    }
    else{
      curl_setopt($ch, CURLOPT_URL, $url);
      if ( !empty($options['DELETE']) ){
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      }
    }

    $r = curl_exec($ch);
    if ( !$r ){
      self::log(["PROBLEME AVEC L'URL $url", curl_error($ch), curl_getinfo($ch)], 'curl');
    }
    return $r;
  }