phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


PHP WDDX: Creating Web Service Client

Tag: wddx. distributed data, web service, client   Category: PHP Application
post: 30 Apr 2008 read: 388


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

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting