src/bbn/x.php
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;
  }
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;
  }
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 ; }
Makes a Curl call towards a URL and returns the result as a string.

```php
$url = 'https://www.omdbapi.com/';
$param = ['t'=>'la vita è bella'];
\bbn\x::hdump(\bbn\x::curl($url,$param, ['POST' => false]));

// object {"Title":"La  vita  è  bella","Year":"1943","Rated":"N/A","Released":"26  May  1943","Runtime":"76  min","Genre":"Comedy","Director":"Carlo  Ludovico  Bragaglia","Writer":"Carlo  Ludovico  Bragaglia  (story  and  screenplay)","Actors":"Alberto  Rabagliati,  María  Mercader,  Anna  Magnani,  Carlo  Campanini","Plot":"N/A","Language":"Italian","Country":"Italy","Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BYmYyNzA2YWQtNDgyZC00OWVkLWIwMTEtNTdhNDQwZjcwYTMwXkEyXkFqcGdeQXVyNTczNDAyMDc@._V1_SX300.jpg","Metascore":"N/A","imdbRating":"7.9","imdbVotes":"50","imdbID":"tt0036502","Type":"movie","Response":"True"}
```

@param string $url
@param array $param
@param array $options
@return mixed
Makes a Curl call towards a URL and returns the result as a string .