当前位置: 首页>>代码示例>>PHP>>正文


PHP Http::userAgent方法代码示例

本文整理汇总了PHP中Http::userAgent方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::userAgent方法的具体用法?PHP Http::userAgent怎么用?PHP Http::userAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Http的用法示例。


在下文中一共展示了Http::userAgent方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: queuePurge

 /**
  * Queue a purge operation
  *
  * @param string $url
  */
 public function queuePurge($url)
 {
     global $wgSquidPurgeUseHostHeader;
     $url = SquidUpdate::expand(str_replace("\n", '', $url));
     $request = array();
     if ($wgSquidPurgeUseHostHeader) {
         $url = wfParseUrl($url);
         $host = $url['host'];
         if (isset($url['port']) && strlen($url['port']) > 0) {
             $host .= ":" . $url['port'];
         }
         $path = $url['path'];
         if (isset($url['query']) && is_string($url['query'])) {
             $path = wfAppendQuery($path, $url['query']);
         }
         $request[] = "PURGE {$path} HTTP/1.1";
         $request[] = "Host: {$host}";
     } else {
         $request[] = "PURGE {$url} HTTP/1.0";
     }
     $request[] = "Connection: Keep-Alive";
     $request[] = "Proxy-Connection: Keep-Alive";
     $request[] = "User-Agent: " . Http::userAgent() . ' ' . __CLASS__;
     // Two ''s to create \r\n\r\n
     $request[] = '';
     $request[] = '';
     $this->requests[] = implode("\r\n", $request);
     if ($this->currentRequestIndex === null) {
         $this->nextRequest();
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:36,代码来源:SquidPurgeClient.php

示例2: getUserAgent

 /**
  * The user agent the ForeignAPIRepo will use.
  */
 public static function getUserAgent()
 {
     return Http::userAgent() . " ForeignAPIRepo/" . self::VERSION;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:7,代码来源:ForeignAPIRepo.php

示例3: execute

	/**
	 * Take care of whatever is necessary to perform the URI request.
	 *
	 * @return Status
	 */
	public function execute() {
		global $wgTitle;

		wfProfileIn( __METHOD__ );

		$this->content = "";

		if ( strtoupper( $this->method ) == "HEAD" ) {
			$this->headersOnly = true;
		}

		if ( is_object( $wgTitle ) && !isset( $this->reqHeaders['Referer'] ) ) {
			$this->setReferer( wfExpandUrl( $wgTitle->getFullURL(), PROTO_CURRENT ) );
		}

		$this->proxySetup(); // set up any proxy as needed

		if ( !$this->callback ) {
			$this->setCallback( array( $this, 'read' ) );
		}

		if ( !isset( $this->reqHeaders['User-Agent'] ) ) {
			$this->setUserAgent( Http::userAgent() );
		}

		wfProfileOut( __METHOD__ );
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:32,代码来源:HttpFunctions.php

示例4: queuePurge

 /**
  * Queue a purge operation
  *
  * @param $url string
  */
 public function queuePurge($url)
 {
     $url = str_replace("\n", '', $url);
     $this->requests[] = "PURGE {$url} HTTP/1.0\r\n" . "Connection: Keep-Alive\r\n" . "Proxy-Connection: Keep-Alive\r\n" . "User-Agent: " . Http::userAgent() . ' ' . __CLASS__ . "\r\n\r\n";
     if ($this->currentRequestIndex === null) {
         $this->nextRequest();
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:13,代码来源:SquidPurgeClient.php

示例5: execute

 /**
  * Take care of whatever is necessary to perform the URI request.
  *
  * @return Status
  */
 public function execute()
 {
     global $wgTitle;
     $this->content = "";
     if (strtoupper($this->method) == "HEAD") {
         $this->headersOnly = true;
     }
     if (is_array($this->postData)) {
         $this->postData = wfArrayToCGI($this->postData);
     }
     if (is_object($wgTitle) && !isset($this->reqHeaders['Referer'])) {
         $this->setReferer($wgTitle->getFullURL());
     }
     if (!$this->noProxy) {
         $this->proxySetup();
     }
     if (!$this->callback) {
         $this->setCallback(array($this, 'read'));
     }
     if (!isset($this->reqHeaders['User-Agent'])) {
         $this->setUserAgent(Http::userAgent());
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:28,代码来源:HttpFunctions.php

示例6: execute

 /**
  * Take care of whatever is necessary to perform the URI request.
  *
  * @return Status
  */
 public function execute()
 {
     $this->content = "";
     if (strtoupper($this->method) == "HEAD") {
         $this->headersOnly = true;
     }
     $this->proxySetup();
     // set up any proxy as needed
     if (!$this->callback) {
         $this->setCallback([$this, 'read']);
     }
     if (!isset($this->reqHeaders['User-Agent'])) {
         $this->setUserAgent(Http::userAgent());
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:20,代码来源:HttpFunctions.php

示例7: getCurlBaseOpts

 function getCurlBaseOpts()
 {
     //I chose to return this as a function so it's easy to override.
     //TODO: probably this for all the junk I currently have stashed in the constructor.
     //...maybe.
     $opts = array(CURLOPT_URL => $this->url, CURLOPT_USERAGENT => Http::userAgent(), CURLOPT_HEADER => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => self::getGlobal('Timeout'), CURLOPT_FOLLOWLOCATION => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_FORBID_REUSE => true, CURLOPT_POST => 1);
     // set proxy settings if necessary
     if (self::getGlobal('UseHTTPProxy')) {
         $opts[CURLOPT_HTTPPROXYTUNNEL] = 1;
         $opts[CURLOPT_PROXY] = self::getGlobal('HTTPProxy');
     }
     return $opts;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:13,代码来源:gateway.adapter.php

示例8: setUserAgent

 /**
  * set user agent
  *
  * @param string $userAgent
  */
 public static function setUserAgent($userAgent)
 {
     self::$userAgent = $userAgent;
 }
开发者ID:jakehu,项目名称:tools,代码行数:9,代码来源:Http.php

示例9: getUserAgent

 static function getUserAgent()
 {
     return Http::userAgent();
 }
开发者ID:wikimedia,项目名称:wikimedia-fundraising-crm-vendor,代码行数:4,代码来源:WmfFramework.mediawiki.php

示例10: execute

 /**
  * Take care of whatever is necessary to perform the URI request.
  *
  * @return Status
  */
 public function execute()
 {
     global $wgTitle;
     $this->content = "";
     if (strtoupper($this->method) == "HEAD") {
         $this->headersOnly = true;
     }
     if (is_object($wgTitle) && !isset($this->reqHeaders['Referer'])) {
         $this->setReferer(wfExpandUrl($wgTitle->getFullURL(), PROTO_CURRENT));
     }
     if (!$this->noProxy) {
         $this->proxySetup();
     }
     if (!$this->callback) {
         $this->setCallback(array($this, 'read'));
     }
     if (!isset($this->reqHeaders['User-Agent'])) {
         $this->setUserAgent(Http::userAgent());
     }
     // @author macbre
     // pass Request ID to internal requests
     $this->setHeader(Wikia\Util\RequestId::REQUEST_HEADER_NAME, Wikia\Util\RequestId::instance()->getRequestId());
     // Wikia change - begin - @author: wladek
     // Append extra headers for internal requests, currently only X-Request-Origin-Host
     if ($this->internalRequest) {
         $this->setHeader(Wikia\Util\RequestId::REQUEST_HEADER_ORIGIN_HOST, wfHostname());
     }
     // Wikia change - end
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:HttpFunctions.php

示例11: getUserAgent

 /**
  * @return string
  */
 private static function getUserAgent()
 {
     return Http::userAgent() . ' MetricsReporting/' . METRICS_REPORTING_VERSION;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:fetchOfflineGoogleSpreadsheet.php


注:本文中的Http::userAgent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。