public function run() {
        // Setup connection
        $resource = curl_init();

        // Set cURL options
        foreach ($this->settings as $option => $setting) {
            curl_setopt($resource, $option, $setting);
        }

        // Process headers
        $headers = [];
        foreach ($this->headers as $key => $value) {
            if (!empty($value)) {
                $headers[] = implode(' : ', [$key, $value]);
            }
            else {
                $this->headers[] = $key;
            }
        }

        // Add the headers
        curl_setopt($resource, CURLOPT_HTTPHEADER, $headers);

        // Execute cURL
        $response = curl_exec($resource);

        // Get the size of the header
        $header_size = curl_getinfo($resource, CURLINFO_HEADER_SIZE);

        // Get the header from the result
        $headers = substr($response, 0, $header_size);

        // Get the body from the result
        $body = substr($response, $header_size);

        // Get the HTTP response code from the result
        $responseCode = curl_getinfo($resource, CURLINFO_HTTP_CODE);

        // Close the connection
        curl_close($resource);

        // Create Result instance
        $this->result = new Result($body, $responseCode, $headers);

        return $this->result;
    }
public function run() {
        // Setup connection
        $resource = curl_init();

        // Set cURL options
        foreach ($this->settings as $option => $setting) {
            curl_setopt($resource, $option, $setting);
        }

        // Process headers
        $headers = [];
        foreach ($this->headers as $key => $value) {
            if (!empty($value)) {
                $headers[] = implode(' : ', [$key, $value]);
            }
            else {
                $this->headers[] = $key;
            }
        }

        // Add the headers
        curl_setopt($resource, CURLOPT_HTTPHEADER, $headers);

        // Execute cURL
        $response = curl_exec($resource);

        // Get the size of the header
        $header_size = curl_getinfo($resource, CURLINFO_HEADER_SIZE);

        // Get the header from the result
        $headers = substr($response, 0, $header_size);

        // Get the body from the result
        $body = substr($response, $header_size);

        // Get the HTTP response code from the result
        $responseCode = curl_getinfo($resource, CURLINFO_HTTP_CODE);

        // Close the connection
        curl_close($resource);

        // Create Result instance
        $this->result = new Result($body, $responseCode, $headers);

        return $this->result;
    }
public function run ( ) { // Setup connection $ resource = curl_init ( ) ; // Set cURL options foreach ( $ this -> settings as $ option => $ setting ) { curl_setopt ( $ resource , $ option , $ setting ) ; } // Process headers $ headers = [ ] ; foreach ( $ this -> headers as $ key => $ value ) { if ( ! empty ( $ value ) ) { $ headers [ ] = implode ( ' : ' , [ $ key , $ value ] ) ; } else { $ this -> headers [ ] = $ key ; } } // Add the headers curl_setopt ( $ resource , CURLOPT_HTTPHEADER , $ headers ) ; // Execute cURL $ response = curl_exec ( $ resource ) ; // Get the size of the header $ header_size = curl_getinfo ( $ resource , CURLINFO_HEADER_SIZE ) ; // Get the header from the result $ headers = substr ( $ response , 0 , $ header_size ) ; // Get the body from the result $ body = substr ( $ response , $ header_size ) ; // Get the HTTP response code from the result $ responseCode = curl_getinfo ( $ resource , CURLINFO_HTTP_CODE ) ; // Close the connection curl_close ( $ resource ) ; // Create Result instance $ this -> result = new Result ( $ body , $ responseCode , $ headers ) ; return $ this -> result ; }
Actually executes the cURL request

@return Result
Actually executes the cURL request