I have a PHP webservice that feeds another php page, basically the user can hit a button online and the webservice is called has many times as necessary making it easy to maintain, not sure if this is what you need but it works fine for me right now, here is part of the code.
My webservice returns json or xml, I found this piece on the web and modified to fit my needs.
<?php
case 'whateveryourwebserviceaction':
$params = array("test");
$tsql = "select * from test where test=?";
/*Execute the query with a scrollable cursor so
we can determine the number of rows returned.*/
$cursorType = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
$getProducts = sqlsrv_query($conn, $tsql, $params, $cursorType);
if ( $getProducts === false)
die( FormatErrors( sqlsrv_errors() ) );
$posts = array();
while( $post = sqlsrv_fetch_array( $getProducts, SQLSRV_FETCH_ASSOC))
{
$posts[]=array('post'=>$post);
}
break;
}
if($format == 'json') {
header('Content-type: application/json');
echo json_encode(array('posts'=>$posts));
}
else {
header('Content-type: text/xml');
echo '<posts>';
foreach($posts as $index => $post) {
if(is_array($post)) {
foreach($post as $key => $value) {
echo '<',$key,'>';
if(is_array($value)) {
foreach($value as $tag => $val) {
echo '<',$tag,'>',htmlentities($val),'</',$tag,'>';
}
}
echo '</',$key,'>';
}
}
}
echo '</posts>';
}
?>
And here is how i call this thing from my php page using jquery.
$.ajax({
type: "GET",
url: "htto:\\server.com?action=whateveryourwebserviceaction&format=json",
dataType: "xml",
success: parseXml,
error: function (xml) {
alert(xml.status + ' ' + xml.statusText);
}});
you can call this function on any user input and refresh with the results provided by the webservice, hopefully this will help you keep going.