PHP WDDX: Creating Web Service Client
Web Distributed Data Exchange Step By Step tutorial - Part 12: Ok, this is last post in wddx series. We will create code for web service client side.
Create a file named "client.php" within www/test/wddx. Enter following code:
<?php
$remote_server = "http://localhost/test/wddx/server.php";
$fo = fopen($remote_server,"r");
$arrData = wddx_deserialize($fo);
?>
<html>
<head>
<title>WDDX Client</title>
</head>
<body>
<table>
<tr>
<th>Id</th>
<th>Title</th>
<th>Author</th>
<th>Description</th>
</tr>
<? foreach($arrData as $k=>$v){ ?>
<tr>
<td><?=$v['id']?></td>
<td><?=$v['title']?></td>
<td><?=$v['author']?></td>
<td><?=$v['description']?></td>
</tr>
<? } ?>
</table>
</body>
</html>
Now, test it. Point your browser to http://localhost/test/wddx/client.php.
It is simple, isn't it?
| Series this article: PHP WDDX: Introduction PHP WDDX: Understanding Anatomy of WDDX PHP WDDX: Understanding Data Elements PHP WDDX: Understanding Simple Data Type PHP WDDX: Using Array Elements PHP WDDX: Struct Element PHP WDDX: Recordset Element PHP WDDX: Simple Serialization Using PHP function PHP WDDX: Complex Serialization PHP WDDX: Unserializing Data PHP WDDX: Creating Web Service Server PHP WDDX: Creating Web Service Client Tag: wddx. distributed data, web service, client Category: PHP Application Post : April 30th 2008 Read: 3,926 blog comments powered by Disqus |
