Skip to content

Instantly share code, notes, and snippets.

@ayonliu
Created June 12, 2014 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayonliu/a1c2b46459b1e4574691 to your computer and use it in GitHub Desktop.
Save ayonliu/a1c2b46459b1e4574691 to your computer and use it in GitHub Desktop.
How to use HessianPHP
<?php
include 'src/HessianClient.php';
$fp = fopen(dirname(__FILE__).'/unit_tests/ok.png', "r");
$options = new HessianOptions();
$options->version = 2;
$options->transport = "http";
// hessian server address
$url = 'http://localhost/hessian/testReceive.php';
//echo "Testing in url $this->url<br>";
$proxy = new HessianClient($url, $options);
//$fp = 'hello';
$data['fp'] = $fp;
header('Content-Type: image/png');
// request server method: getFile()
echo $proxy->getFile($data['fp']);
<?php
include 'src/HessianService.php';
/**
*
*/
class FileClass
{
function getFile($file)
{
//return $file . ' hessian';
return $file;
}
}
$testService = new FileClass();
$server = new HessianService($testService, array('displayInfo' => true));
$server->handle();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment