PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Martin Barker   PHP JSON RPC Objective Server   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: example script showing how to test the serevr
Class: PHP JSON RPC Objective Server
Handle API requests to a JSON RPC server
Author: By
Last change:
Date: 8 years ago
Size: 443 bytes
 

Contents

Class file image Download
<?php
// works
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://serverurl/" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"jsonrpc":"2.0", "method":"example.ping", "params":["hello world"], "id":0}' );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));

$result=curl_exec ($ch);
echo
$result;