Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (45 sloc) 1.047 kB
<?php
namespace Guzzle\Http;
use Guzzle\Common\Version;
use Guzzle\Http\Curl\CurlVersion;
/**
* HTTP utility class
*/
class Utils
{
/**
* @var string
*/
protected static $userAgent;
/**
* Create an RFC 1123 HTTP-Date from various date values
*
* @param string|int $date Date to convert
*
* @return string
*/
public static function getHttpDate($date)
{
if (!is_numeric($date)) {
$date = strtotime($date);
}
return gmdate('D, d M Y H:i:s \G\M\T', $date);
}
/**
* Get the default User-Agent to add to requests sent through the library
*
* @return string
*/
public static function getDefaultUserAgent()
{
if (!self::$userAgent) {
self::$userAgent = sprintf(
'Guzzle/%s curl/%s PHP/%s',
Version::VERSION,
CurlVersion::getInstance()->get('version'),
PHP_VERSION
);
}
return self::$userAgent;
}
}
Jump to Line
Something went wrong with that request. Please try again.