Title: Curl
Published: March 29, 2023
Last modified: November 8, 2023

---

# class Curl {}

## In this article

 * [Methods](https://developer.wordpress.org/reference/classes/wporg-requests-exception-transport-curl/?output_format=md#methods)
 * [Source](https://developer.wordpress.org/reference/classes/wporg-requests-exception-transport-curl/?output_format=md#source)

[ Back to top](https://developer.wordpress.org/reference/classes/wporg-requests-exception-transport-curl/?output_format=md#wp--skip-link--target)

CURL Transport Exception.

## 󠀁[Methods](https://developer.wordpress.org/reference/classes/wporg-requests-exception-transport-curl/?output_format=md#methods)󠁿

| Name | Description | 
| [Curl::__construct](https://developer.wordpress.org/reference/classes/wporg-requests-exception-transport-curl/__construct/) | Create a new exception. | 
| [Curl::getReason](https://developer.wordpress.org/reference/classes/wporg-requests-exception-transport-curl/getreason/) | Get the error message. |

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wporg-requests-exception-transport-curl/?output_format=md#source)󠁿

    ```php
    final class Curl extends Transport {

    	const EASY  = 'cURLEasy';
    	const MULTI = 'cURLMulti';
    	const SHARE = 'cURLShare';

    	/**
    	 * cURL error code
    	 *
    	 * @var integer
    	 */
    	protected $code = -1;

    	/**
    	 * Which type of cURL error
    	 *
    	 * EASY|MULTI|SHARE
    	 *
    	 * @var string
    	 */
    	protected $type = 'Unknown';

    	/**
    	 * Clear text error message
    	 *
    	 * @var string
    	 */
    	protected $reason = 'Unknown';

    	/**
    	 * Create a new exception.
    	 *
    	 * @param string $message Exception message.
    	 * @param string $type    Exception type.
    	 * @param mixed  $data    Associated data, if applicable.
    	 * @param int    $code    Exception numerical code, if applicable.
    	 */
    	public function __construct($message, $type, $data = null, $code = 0) {
    		if ($type !== null) {
    			$this->type = $type;
    		}

    		if ($code !== null) {
    			$this->code = (int) $code;
    		}

    		if ($message !== null) {
    			$this->reason = $message;
    		}

    		$message = sprintf('%d %s', $this->code, $this->reason);
    		parent::__construct($message, $this->type, $data, $this->code);
    	}

    	/**
    	 * Get the error message.
    	 *
    	 * @return string
    	 */
    	public function getReason() {
    		return $this->reason;
    	}

    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/requests/src/exception/transport/curl.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/Requests/src/Exception/Transport/Curl.php#L17)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/Requests/src/Exception/Transport/Curl.php#L17-L80)

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwporg-requests-exception-transport-curl%2F)
before being able to contribute a note or feedback.