Replies (6)

  • Hi first thanks for this class!

    I think we need to fix one of the method parameter:
    public function method( method = 'get' ) to public function method( $method = 'get' )

    '$' is missing for the parameter variable name.
  • I think I spotted another mistake. Your send method requires $this->handler to be set before executing, but the first time it gets set is during the following statement:

    if( $this->handler !== null ){
    $this->handler = curl_init( );
    }
  • I notice you have info as private in the last code example:

    // class variable that will hold the info of our request
    private $info = [];

    In the first version you have it public but in the last example it is set to private. Due to private setting the check status of $curl->info will not work right? It took me some time to figure out what was wrong as I'm new to OOP.
  • Great examples!

    $curl->info['http_status_code'] == 200 should be $curl->info['http_code'] == 200

Reply