本文整理汇总了PHP中HttpRequest::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::__construct方法的具体用法?PHP HttpRequest::__construct怎么用?PHP HttpRequest::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::__construct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($curlHandle, $path, $accept, array $params = NULL)
{
parent::__construct($curlHandle, $path, $accept, $params);
$this->httpMethod = "HEAD";
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, $this->httpMethod);
curl_setopt($curlHandle, CURLOPT_NOBODY, TRUE);
}
示例2: __construct
/**
* Constructor
*
* @param ObjectConfig|null $config An optional ObjectConfig object with configuration options
* @return HttpResponse
*/
public function __construct(ObjectConfig $config)
{
parent::__construct($config);
//Set query parameters
$this->setQuery($config->query);
//Set data parameters
$this->setData($config->data);
}
示例3: __construct
/**
* Constructor
*
* @param ObjectConfig|null $config An optional ObjectConfig object with configuration options
*/
public function __construct(ObjectConfig $config)
{
parent::__construct($config);
// Set the user identifier
$this->_user = $config->user;
//Set query parameters
$this->setQuery($config->query);
//Set data parameters
$this->setData($config->data);
//Set the format
$this->setFormat($config->format);
}
示例4:
function __construct($app_id, $app_key, $app_secret)
{
//put the FB API keys here:
$this->fb_id = $app_id;
$this->fb_key = $app_key;
$this->fb_secret = $app_secret;
//call parent constructor
parent::__construct();
//set up the specifics for connecting to facebook's api
$this->request_params['port'] = 443;
$this->request_params['scheme'] = 'tls://';
$this->request_params['host'] = $this->fb_d;
}
示例5: __construct
public function __construct($curlHandle, $path, $accept, array $params = NULL)
{
parent::__construct($curlHandle, $path, $accept, NULL);
$this->httpMethod = "DELETE";
$this->contentType = parent::URLENCODED;
$this->path = $path;
$this->curlHandle = $curlHandle;
$this->accept = $accept;
// set the http method
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, $this->httpMethod);
if ($params != NULL) {
$this->body = http_build_query($params);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $this->body);
}
}
示例6: __construct
public function __construct($url, $requestMethod = HTTP_METH_GET, array $options = array())
{
static $proxyOptions = array(), $hasProxyOptions = false;
// Proxy settings from site.ini
if (!$hasProxyOptions) {
$ini = eZINI::instance();
$proxyServer = $ini->hasVariable('ProxySettings', 'ProxyServer') ? $ini->variable('ProxySettings', 'ProxyServer') : false;
if ($proxyServer) {
$proxyServerParts = parse_url($proxyServer);
$proxyOptions['proxyhost'] = $proxyServerParts['host'];
$proxyOptions['proxyport'] = $proxyServerParts['port'];
$proxyOptions['proxytype'] = HTTP_PROXY_HTTP;
$proxyUsername = $ini->hasVariable('ProxySettings', 'User') ? $ini->variable('ProxySettings', 'User') : false;
$proxyPassword = $ini->hasVariable('ProxySettings', 'Password') ? $ini->variable('ProxySettings', 'Password') : false;
if ($proxyUsername) {
$proxyOptions['proxyauth'] = "{$proxyUsername}:{$proxyPassword}";
}
}
$hasProxyOptions = true;
}
parent::__construct($url, $requestMethod, $options + $proxyOptions);
}
示例7: __construct
/**
* コンストラクタ
*
* @param string $url
* @param string $destination
* @param array $options
* @param P2HttpCallback $onSuccess
* @param P2HttpCallback $onFailure
*/
public function __construct($url, $destination, array $options = null, P2HttpCallback $onSuccess = null, P2HttpCallback $onFailure = null)
{
global $_conf;
if ($options === null) {
$options = array();
}
if (!isset($options['connecttimeout'])) {
$options['connecttimeout'] = $_conf['fsockopen_time_limit'];
}
if (!isset($options['timeout'])) {
$options['timeout'] = $_conf['fsockopen_time_limit'] * 2;
}
if (!isset($options['compress'])) {
$options['compress'] = true;
}
if (!isset($options['useragent'])) {
$options['useragent'] = P2Util::getP2UA($withMonazilla = true);
}
if ($_conf['proxy_use'] && !isset($options['proxyhost']) && !empty($_conf['proxy_host'])) {
$options['proxyhost'] = $_conf['proxy_host'];
if (!empty($_conf['proxy_port']) && is_numeric($_conf['proxy_port'])) {
$options['proxyport'] = (int) $_conf['proxy_port'];
} elseif (strpos($_conf['proxy_host'], ':') === false) {
$options['proxyport'] = 80;
}
/*
$options['proxytype'] = HTTP_PROXY_HTTP;
if (isset($_conf['proxy_type'])) {
switch ($_conf['proxy_type']) {
case 'http': $options['proxytype'] = HTTP_PROXY_HTTP; break;
case 'socks4': $options['proxytype'] = HTTP_PROXY_SOCKS4; break;
case 'socks5': $options['proxytype'] = HTTP_PROXY_SOCKS5; break;
default:
if (is_numeric($options['proxytype'])) {
$options['proxytype'] = (int)$_conf['proxy_type'];
}
}
}
if (!empty($_conf['proxy_auth'])) {
$options['proxy_auth'] = $_conf['proxy_auth'];
$options['proxyauthtype'] = HTTP_AUTH_BASIC;
if (isset($_conf['proxy_auth_type'])) {
switch ($_conf['proxy_auth_type']) {
case 'basic': $options['proxyauthtype'] = HTTP_AUTH_BASIC; break;
case 'digest': $options['proxyauthtype'] = HTTP_AUTH_DIGEST; break;
case 'ntlm': $options['proxyauthtype'] = HTTP_AUTH_NTLM; break;
case 'gssneg': $options['proxyauthtype'] = HTTP_AUTH_GSSNEG; break;
case 'any': $options['proxyauthtype'] = HTTP_AUTH_ANY; break;
default:
if (is_numeric($options['proxytype'])) {
$options['proxyauthtype'] = (int)$_conf['proxy_auth_type'];
}
}
}
}
*/
}
if (!isset($options['lastmodified']) && file_exists($destination)) {
$options['lastmodified'] = filemtime($destination);
} else {
FileCtl::mkdir_for($destination);
}
$this->_destination = $destination;
$this->_permission = !empty($_conf['dl_perm']) ? $_conf['dl_perm'] : 0666;
$this->_errorCode = self::E_NONE;
$this->_errorInfo = '';
$this->_onSuccess = $onSuccess;
$this->_onFailure = $onFailure;
$this->_next = null;
parent::__construct($url, HttpRequest::METH_GET, $options);
}