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


PHP SimpleHttpRequest::addHeaderLine方法代码示例

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


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

示例1: addAdditionalHeaders

 /**
  *    Adds additional manual headers.
  *    @param SimpleHttpRequest $request    Outgoing request.
  *    @access private
  */
 protected function addAdditionalHeaders(&$request)
 {
     foreach ($this->additional_headers as $header) {
         $request->addHeaderLine($header);
     }
 }
开发者ID:Boris-de,项目名称:videodb,代码行数:11,代码来源:user_agent.php

示例2: addBasicHeaders

 /**
  *    Presents the appropriate headers for this
  *    location for basic authentication.
  *    @param SimpleHttpRequest $request  Request to modify.
  *    @param string $username            Username for realm.
  *    @param string $password            Password for realm.
  *    @access public
  */
 static function addBasicHeaders($request, $username, $password)
 {
     if ($username && $password) {
         $request->addHeaderLine('Authorization: Basic ' . base64_encode("{$username}:{$password}"));
     }
 }
开发者ID:GerHobbelt,项目名称:simpletest,代码行数:14,代码来源:authentication.php

示例3: testWritingAdditionalHeaders

 public function testWritingAdditionalHeaders()
 {
     $socket = new MockSimpleSocket();
     $socket->expectAt(0, 'write', array("My: stuff\r\n"));
     $socket->expectAt(1, 'write', array("\r\n"));
     $socket->expectCallCount('write', 2);
     $route = new MockSimpleRoute();
     $route->setReturnReference('createConnection', $socket);
     $request = new SimpleHttpRequest($route, new SimpleGetEncoding());
     $request->addHeaderLine('My: stuff');
     $request->fetch(15);
 }
开发者ID:VasuLief,项目名称:simpletest,代码行数:12,代码来源:http_test.php

示例4: foreach

 /**
  *    Adds additional manual headers.
  *    @param SimpleHttpRequest $request    Outgoing request.
  *    @access private
  */
 function _addAdditionalHeaders($request)
 {
     foreach ($this->_additional_headers as $header) {
         $request->addHeaderLine($header);
     }
 }
开发者ID:Nurudeen,项目名称:prado,代码行数:11,代码来源:user_agent.php

示例5: addBasicHeaders

 /**
  *    Presents the appropriate headers for this
  *    location for basic authentication.
  *    @param SimpleHttpRequest $request  Request to modify.
  *    @param string $username            Username for realm.
  *    @param string $password            Password for realm.
  *    @access public
  *    @static
  */
 function addBasicHeaders(&$request, $username, $password) {
     if ($username && $password) {
         $request->addHeaderLine(
                 'Authorization: Basic ' . base64_encode("$username:$password"));
     }
 }
开发者ID:unruthless,项目名称:ThinkUp,代码行数:15,代码来源:authentication.php

示例6: testWritingAdditionalHeaders

 function testWritingAdditionalHeaders()
 {
     $request = new SimpleHttpRequest("http://a.valid.host/and/path");
     $request->addHeaderLine("My: stuff");
     $socket =& new MockSimpleSocket($this);
     $socket->setReturnValue("isError", false);
     $socket->expectArgumentsSequence(0, "write", array("GET /and/path HTTP/1.0\r\n"));
     $socket->expectArgumentsSequence(1, "write", array("Host: a.valid.host\r\n"));
     $socket->expectArgumentsSequence(2, "write", array("My: stuff\r\n"));
     $socket->expectArgumentsSequence(3, "write", array("Connection: close\r\n"));
     $socket->expectArgumentsSequence(4, "write", array("\r\n"));
     $socket->expectCallCount("write", 5);
     $request->fetch($socket);
     $socket->tally();
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:15,代码来源:http_test.php


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