Skip to content

Commit

Permalink
Added wrapper for curl_getinfo and getter for URL (#41)
Browse files Browse the repository at this point in the history
Thank you.
  • Loading branch information
Bob Z Saludo authored and amouhzi committed Jul 28, 2017
1 parent 96f5bd4 commit 17dfffa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,33 @@ public function setOpt($option, $value)
{
return curl_setopt($this->curl, $option, $value);
}

/**
* Get customized curl options.
*
* To see a full list of options: http://php.net/curl_getinfo
*
* @see http://php.net/curl_getinfo
*
* @param int $option The curl option constante e.g. `CURLOPT_AUTOREFERER`, `CURLOPT_COOKIESESSION`
* @param mixed $value The value to check for the given $option
*/
public function getOpt($option)
{
return curl_getinfo($this->curl, $option);
}

/**
* Return the endpoint set for curl
*
* @see http://php.net/curl_getinfo
*
* @return string of endpoint
*/
public function getEndpoint()
{
return $this->getOpt(CURLINFO_EFFECTIVE_URL);
}

/**
* Enable verbositiy.
Expand Down

0 comments on commit 17dfffa

Please sign in to comment.