client.php 675 B

1234567891011121314151617181920212223
  1. <?php
  2. $url = 'http://vps.colobu.com:9981/';
  3. $data = '{"A":10, "B":20}';
  4. // use key 'http' even if you send the request to https://...
  5. $options = array(
  6. 'http' => array(
  7. 'header' => "Content-type: application/rpcx\r\n" .
  8. // "X-RPCX-MessageID: 12345678\r\n" .
  9. // "X-RPCX-MesssageType: 0\r\n" .
  10. "X-RPCX-SerializeType: 1\r\n" .
  11. "X-RPCX-ServicePath: Arith\r\n" .
  12. "X-RPCX-ServiceMethod: Mul\r\n",
  13. 'method' => 'POST',
  14. 'content' => $data
  15. )
  16. );
  17. $context = stream_context_create($options);
  18. $result = file_get_contents($url, false, $context);
  19. if ($result === FALSE) { /* Handle error */ }
  20. var_dump($result);
  21. ?>