[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/examples/ -> remote-proxy.php (source)

   1  <?php
   2  
   3  require_once  __DIR__ . '/../vendor/autoload.php';
   4  
   5  use ProxyManager\Factory\RemoteObject\Adapter\XmlRpc;
   6  use ProxyManager\Factory\RemoteObjectFactory;
   7  use Zend\XmlRpc\Client;
   8  
   9  if (! class_exists('Zend\XmlRpc\Client')) {
  10      echo "This example needs Zend\\XmlRpc\\Client to run. \n In order to install it, "
  11      . "please run following:\n\n"
  12      . "\$ php composer.phar require zendframework/zend-xmlrpc:2.*\n\n";
  13  
  14      exit(2);
  15  }
  16  
  17  class Foo
  18  {
  19      public function bar()
  20      {
  21          return 'bar local!';
  22      }
  23  }
  24  
  25  $factory = new RemoteObjectFactory(
  26      new XmlRpc(new Client('http://localhost:9876/remote-proxy/remote-proxy-server.php'))
  27  );
  28  $proxy = $factory->createProxy('Foo');
  29  
  30  try {
  31      var_dump($proxy->bar()); // bar remote !
  32  } catch (\Zend\Http\Client\Adapter\Exception\RuntimeException $error) {
  33      echo "To run this example, please following before:\n\n\$ php -S localhost:9876 -t \"" . __DIR__ . "\"\n";
  34  
  35      exit(2);
  36  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1