cvs: php4 /pear/Net Curl.php

From: Date: Tue, 30 Oct 2001 09:36:30 +0000
Subject: cvs: php4 /pear/Net Curl.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1197@lists.php.net to get a copy of this message
sterling Tue Oct 30 04:36:30 2001 EDT Modified files: /php4/pear/Net Curl.php Log: @ Add an option to set the User-Agent ($obj->userAgent) to Net_Curl @ (graeme@i7.com.au) Index: php4/pear/Net/Curl.php diff -u php4/pear/Net/Curl.php:1.5 php4/pear/Net/Curl.php:1.6 --- php4/pear/Net/Curl.php:1.5 Mon Oct 22 14:52:04 2001 +++ php4/pear/Net/Curl.php Tue Oct 30 04:36:29 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Curl.php,v 1.5 2001/10/22 18:52:04 sterling Exp $ +// $Id: Curl.php,v 1.6 2001/10/30 09:36:29 sterling Exp $ // // A nice friendly OO interface for CURL // @@ -58,6 +58,14 @@ * @access public */ var $sslCertPasswd; + + /** + * User Agent string when making an HTTP request + * + * @var string $userAgent + * @access public + */ + var $userAgent; /** * Whether or not to include the header in the results @@ -244,7 +252,7 @@ $ret = curl_setopt($ch, CURLOPT_HEADER, $this->header); // Whether or not to return the transfer contents - if ($this->return_transfer && !$this->file) { + if ($this->return_transfer && !iset($this->file)) { $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); } @@ -329,7 +337,11 @@ $ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $this->follow_location); if ($this->timeout) { - $ret = curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout ); + $ret = curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); + } + + if (isset($this->userAgent)) { + $ret = curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); }

« previous php.pear.cvs (#1197) next »