XRL  2.0.0
Simple XML-RPC Library (both client and server)
Response.php
1 <?php
2 /*
3  * This file is part of XRL, a simple XML-RPC Library for PHP.
4  *
5  * Copyright (c) 2012, XRL Team. All rights reserved.
6  * XRL is licensed under the 3-clause BSD License.
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace fpoirotte\XRL;
13 
22 {
24  protected $result;
25 
33  public function __construct($xmlResult)
34  {
35  if (!is_string($xmlResult)) {
36  throw new \InvalidArgumentException('Not a valid response');
37  }
38 
39  $this->result = $xmlResult;
40  }
41 
43  public function __toString()
44  {
45  return $this->result;
46  }
47 
49  public function publish()
50  {
51  header('Content-Type: text/xml');
52  header('Content-Length: '.strlen($this->result));
53  exit($this->result);
54  }
55 }
This class represents the response to an XML-RPC request.
Definition: Response.php:21
Interface for the response to an XML-RPC request, as produced by an XML-RPC server.
$result
The response to an XML-RPC request, as serialized XML.
Definition: Response.php:24
__construct($xmlResult)
Definition: Response.php:33