Curl\Curl::setUserAgent PHP Method

setUserAgent() public method

Set User Agent
public setUserAgent ( $user_agent )
$user_agent
    public function setUserAgent($user_agent)
    {
        $this->setOpt(CURLOPT_USERAGENT, $user_agent);
    }

Usage Example

Example #1
0
 /**
  * Api constructor.
  *
  * @param string $apiKey API Key
  * @param string $environment API environment
  */
 public function __construct($apiKey, $environment)
 {
     ArgValidator::assert($apiKey, ['string', 'notEmpty']);
     ArgValidator::assert($environment, ['string', 'notEmpty']);
     $this->curl = new Curl();
     $this->curl->setOpt(CURLOPT_RETURNTRANSFER, true);
     $this->curl->setUserAgent('Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0');
     $this->apiUrl = $this->getApiUrl($environment);
     $this->apiKey = $apiKey;
 }
All Usage Examples Of Curl\Curl::setUserAgent