function do_post_request($url, $data){
$header = "Content-type: application/json-rpc\r\n";
$header .= "Content-Length: ".strlen($data)."\r\n";
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
throw new Exception("Problem with $url, $php_errormsg");
$response = @stream_get_contents($fp);
if($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JSONRPC Zabbix API</title>
<script src="http://yui.yahooapis.com/2.8.2r1/build/yahoo/yahoo-min.js"></script>
<script src="http://yui.yahooapis.com/2.8.2r1/build/json/json-min.js"></script>
<script src="http://yandex.st/highlightjs/5.16/highlight.min.js"></script>
<link rel="stylesheet" href="http://yandex.st/highlightjs/5.16/styles/idea.min.css">
$_REQUEST['path'] = isset($_REQUEST['path']) ? $_REQUEST['path'] : 'trunk';
$user = isset($_REQUEST['user']) ? $_REQUEST['user'] : 'Admin';
$pswd = isset($_REQUEST['pswd']) ? $_REQUEST['pswd'] : 'zabbix';
$url = 'http://'.$_REQUEST['path'].'/api_jsonrpc.php';
<label>Path: <input type="text" name="path" value="<?php print($_REQUEST['path']);?>"/></label><br />
<label>User: <input type="text" name="user" value="<?php print($user);?>"/></label><br />
<label>Pass: <input type="password" name="pswd" value="<?php print($pswd); ?>"/></label><br />