Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,28 @@ public function get($url, $data = array())
return $this;
}

/**
* Purge Request
*
* A very common scenario to send a purge request is within the use of varnish, therefore
* the optional hostname can be defined.
*
* @param strng $url The url to make the purge request
* @param string $hostname An optional hostname which will be sent as http host header
* @return self
* @since 2.4.0
*/
public function purge($url, $hostName = null)
{
$this->setOpt(CURLOPT_URL, $url);
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PURGE');
if ($hostName) {
$this->setOpt(CURLOPT_HTTPHEADER, array('Host: '. $hostName));
}
$this->exec();
return $this;
}

/**
* Make a post request with optional post data.
*
Expand Down